【问题标题】:Sending Custom field with JMSPaymentCoreBundle and JMSPaymentPaypalBundle使用 JMSPaymentCoreBundle 和 JMSPaymentPaypalBundle 发送自定义字段
【发布时间】:2013-09-05 11:26:54
【问题描述】:

我将 JMSPaymentCoreBundle 与 JMSPaymentPaypalBundle 一起使用,一切正常。但现在我需要向 Paypal 发送一个自定义字段,然后 IPN 消息确认将其发回给我。

我尝试将此“自定义”字段添加为 PaymentInstruction 中的 ExtendedData,但 Paypal 不会将这个自定义字段发回给我。有没有办法做到这一点?我准备 PaymentInstruction 时的部分代码:

$router = $this->get('router');

        $extendedData = new ExtendedData();
        $extendedData->set('return_url',$router->generate('payment_complete', array(
                'id' => $orden->getId(),
        ), true));

        $extendedData->set('cancel_url', $router->generate('payment_cancel', array(
                'id' => $orden->getId(),
        ), true));
        $extendedData->set('default_method', 'payment_paypal');
        $extendedData->set('item_name', $orden->getItemName());
        $extendedData->set('item_number', $orden->getId());
        $extendedData->set('custom', 'customvalue');


        $instruction = new PaymentInstruction((float)$orden->getAmount(), $orden->getCurrency(), 'paypal_express_checkout', $extendedData);
        $ppc = $this->get('payment.plugin_controller');
        $ppc->createPaymentInstruction($instruction);

        $orden->setPaymentInstruction($instruction);
        $em->persist($orden);
        $em->flush();

谢谢!

【问题讨论】:

    标签: symfony paypal


    【解决方案1】:

    我自己回答:

            $extendedData->set('checkout_params',array(
                'PAYMENTREQUEST_0_CUSTOM' => $orden->getId()));
    

    它可以包含其他参数: L_PAYMENTREQUEST_0_NAME0, L_PAYMENTREQUEST_0_NUMBER0, L_PAYMENTREQUEST_0_DESC0, L_PAYMENTREQUEST_0_AMT0, L_PAYMENTREQUEST_0_QTY0, ...

    【讨论】:

      猜你喜欢
      • 2018-05-05
      • 2019-09-21
      • 2013-11-21
      • 2017-01-22
      • 1970-01-01
      • 1970-01-01
      • 2012-11-17
      • 2016-05-10
      • 1970-01-01
      相关资源
      最近更新 更多