PayPal Laravel Integrarion CheckOutStatus = PayentActionNotI



我正在工作的项目,我需要整合支付宝。我在Laravel 8中集成了PayPal。https://devnote.in/how-to-integrate-paypal-payment-gateway-with-laravel/

一切都很完美。但是我无法在我的沙箱活动选项卡中看到事务,所以我调试了代码,我在响应中发现的是

"CHECKOUTSTATUS" => "PaymentActionNotInitiated"

我认为这是错误的

$response = $provider->setExpressCheckout($data);
$response = $provider->setExpressCheckout($data, true);

这是我付款后的回复

"TOKEN" => "EC-2X484972KX015750V"
"BILLINGAGREEMENTACCEPTEDSTATUS" => "1"
"CHECKOUTSTATUS" => "PaymentActionNotInitiated"
"TIMESTAMP" => "2021-08-25T08:46:25Z"
"CORRELATIONID" => "45064f9f5ee81"
"ACK" => "Success"
"VERSION" => "123"
"BUILD" => "55938276"
"EMAIL" => "sb-8dekq7353673@personal.example.com"
"PAYERID" => "9U9985S7EREYQ"
"PAYERSTATUS" => "verified"
"FIRSTNAME" => "John"
"LASTNAME" => "Doe"
"COUNTRYCODE" => "US"
"ADDRESSSTATUS" => "Confirmed"
"CURRENCYCODE" => "USD"
"AMT" => "30.00"
"ITEMAMT" => "30.00"
"SHIPPINGAMT" => "0.00"
"HANDLINGAMT" => "0.00"
"TAXAMT" => "0.00"
"DESC" => "Your order #EL/21-22/7 Invoice"
"INVNUM" => "EL/21-22/7"
"INSURANCEAMT" => "0.00"
"SHIPDISCAMT" => "0.00"
"INSURANCEOPTIONOFFERED" => "false"
"L_NAME0" => "Prem"
"L_QTY0" => "1"
"L_TAXAMT0" => "0.00"
"L_AMT0" => "30.00"
"L_DESC0" => "Order No: EL/21-22/7 ORDER SUMMARY- aosdno"
"PAYMENTREQUEST_0_CURRENCYCODE" => "USD"
"PAYMENTREQUEST_0_AMT" => "30.00"
"PAYMENTREQUEST_0_ITEMAMT" => "30.00"
"PAYMENTREQUEST_0_SHIPPINGAMT" => "0.00"
"PAYMENTREQUEST_0_HANDLINGAMT" => "0.00"
"PAYMENTREQUEST_0_TAXAMT" => "0.00"
"PAYMENTREQUEST_0_DESC" => "Your order #EL/21-22/7 Invoice"
"PAYMENTREQUEST_0_INVNUM" => "EL/21-22/7"
"PAYMENTREQUEST_0_INSURANCEAMT" => "0.00"
"PAYMENTREQUEST_0_SHIPDISCAMT" => "0.00"
"PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID" => "sb-nicfx7337505@business.example.com"
"PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED" => "false"
"L_PAYMENTREQUEST_0_NAME0" => "Prem"
"L_PAYMENTREQUEST_0_QTY0" => "1"
"L_PAYMENTREQUEST_0_TAXAMT0" => "0.00"
"L_PAYMENTREQUEST_0_AMT0" => "30.00"
"L_PAYMENTREQUEST_0_DESC0" => "Order No: EL/21-22/7 ORDER SUMMARY- aosdno"
"PAYMENTREQUESTINFO_0_ERRORCODE" => "0"

有了这个EC API,当买家返回到您的网站时,您应该显示一个最终的订单审查页面,最终的批准操作将触发DoExpressCheckoutPaymentAPI调用(使用返回的url查询字符串中的EC令牌和PayerID)来创建一个PayPal交易。根据响应,您将显示一个感谢/成功消息-或关于无法处理付款的错误消息。在调用DoExpressCheckoutPayment之前,不会创建任何事务。

无论如何,您正在尝试的这种集成是与经典的EC API,这是几代人的旧(大约15年)。你不应该在任何新的集成中使用这个旧的API,你所遵循的指南是相当旧的,应该忽略。


相反,遵循当前的设置标准支付指南,并在您的服务器上创建2个路由,一个用于"创建订单",一个用于"捕获订单",记录在这里。两个路由都应该只返回JSON数据(没有HTML或文本)。在第二条路线中,当捕获API成功时,您应该将其结果支付详细信息存储在数据库中(特别是purchase_units[0].payments.captures[0].id,这是PayPal交易ID),并在将返回JSON转发给前端调用者之前立即执行任何必要的业务逻辑(例如发送确认电子邮件或预订产品)。

将这2条路由与前端审批流程配对:https://developer.paypal.com/demo/checkout/#/pattern/server

相关内容

  • 没有找到相关文章

最新更新