Omnipay 贝宝集成 - 确认付款状态

Posted

技术标签:

【中文标题】Omnipay 贝宝集成 - 确认付款状态【英文标题】:Omnipay paypal integration - confirming payment status 【发布时间】:2016-06-20 21:13:46 【问题描述】:

我使用 Omnipay 贝宝库。我可以成功付款,但无法确认付款状态。在回复中我总是得到PAYMENTINFO_0_PAYMENTSTATUS => Pending

这是我的购买代码 - 我被重定向到贝宝,这一切都很好:

    $gateway = Omnipay::create("PayPal_Express");
    $gateway->setUsername( $this->USERNAME );
    $gateway->setPassword( $this->PASSWORD );
    $gateway->setSignature( $this->SIGNATURE );
    $gateway->setTestMode(true);

    $params = [
      'cancelUrl'=>'http://xxxx.com/paypal_tests/cancel',
      'returnUrl'=>'http://xxxx.com/paypal_tests/confirm_paypal',
      'amount' =>  '10.00',
      'currency' => 'EUR'
    ];

    $response = $gateway->purchase( $params )->send();

    $response->redirect();

还有returnUrl,在回复中我总是得到[PAYMENTINFO_0_PAYMENTSTATUS] => Pending

      $gateway = Omnipay::create("PayPal_Express");
      $gateway->setUsername( $this->USERNAME );
      $gateway->setPassword( $this->PASSWORD );
      $gateway->setSignature( $this->SIGNATURE );
      $gateway->setTestMode(true);

      $response = $gateway->completePurchase( $this->session->PAYPAL  )->send();
      $data = $response->getData(); // this is the raw response object

      echo print_r($data);

这是完整的回复,您可以看到状态为“待处理”。

Array
(
    [TOKEN] => EC-1RA27631NJ550530P
    [SUCCESSPAGEREDIRECTREQUESTED] => false
    [TIMESTAMP] => 2016-03-07T10:29:43Z
    [CORRELATIONID] => 8010f2af74b8
    [ACK] => Success
    [VERSION] => 119.0
    [BUILD] => 18316154
    [INSURANCEOPTIONSELECTED] => false
    [SHIPPINGOPTIONISDEFAULT] => false
    [PAYMENTINFO_0_TRANSACTIONID] => 97R504742X7344311
    [PAYMENTINFO_0_TRANSACTIONTYPE] => expresscheckout
    [PAYMENTINFO_0_PAYMENTTYPE] => instant
    [PAYMENTINFO_0_ORDERTIME] => 2016-03-07T10:29:41Z
    [PAYMENTINFO_0_AMT] => 1.44
    [PAYMENTINFO_0_TAXAMT] => 0.00
    [PAYMENTINFO_0_CURRENCYCODE] => EUR


    [PAYMENTINFO_0_PAYMENTSTATUS] => Pending


    [PAYMENTINFO_0_PENDINGREASON] => multicurrency
    [PAYMENTINFO_0_REASONCODE] => None
    [PAYMENTINFO_0_PROTECTIONELIGIBILITY] => Ineligible
    [PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE] => None
    [PAYMENTINFO_0_SECUREMERCHANTACCOUNTID] => Z6GHSVEW4KGWG
    [PAYMENTINFO_0_ERRORCODE] => 0
    [PAYMENTINFO_0_ACK] => Success
)

如何确认付款已处理、确认并且可以安全发货?

谢谢!

【问题讨论】:

我认为你必须调查一下[PAYMENTINFO_0_PENDINGREASON] => multicurrency:developer.paypal.com/docs/classic/api/merchant/… 谢谢,原来是问题所在。甚至没有注意到那个参数。谢谢!! 【参考方案1】:

好的,我找到了问题,就在这里:

[PAYMENTINFO_0_PENDINGREASON] => multicurrency

基本上我客户的测试账户在美国,而卖家的测试账户以欧元收费,这就是为什么它处于等待状态......

答案就在这里:How do I use omnipay to check if it's a pending payment or not

【讨论】:

以上是关于Omnipay 贝宝集成 - 确认付款状态的主要内容,如果未能解决你的问题,请参考以下文章

Omnipay 贝宝与 laravel 4 的集成

贝宝集成类型混淆

Magento 在贝宝付款前下订单

贝宝智能按钮集成问题

“立即付款”按钮集成的贝宝选项 (PHP)

支付宝快速结账的 Omnipay 错误,您的最后一个操作无法完成