我使用Omnipay paypal库。我可以成功付款但我在确认付款状态时遇到问题。在回复中,我总是得到PAYMENTINFO_0_PAYMENTSTATUS => Pending
这是我的购买代码 - 我被重定向到paypal,这一切都很好:
$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
)
如何确认付款已经处理,确认并且发货安全?
谢谢!
答案 0 :(得分:2)
好的,我发现了问题,就在这里:
[PAYMENTINFO_0_PENDINGREASON] => multicurrency
基本上我的客户的测试帐户在美国,卖家的测试帐户以欧元收费,这就是为什么它正在等待......
答案就在这里:How do I use omnipay to check if it's a pending payment or not