我已成功为我的Symfony应用程序设置了Payum,我已经创建了每天定期付款的订阅。
在我的应用程序中,我从未在payum_notify_do
URL上收到来自paypal的单一请求,该请求在我的payum协议详细信息实体中有很好的引用。
在paypal沙盒验证器帐户上,我可以看到自订阅以来我每天都收到付款。
为什么我从未收到有关付款人的通知? Symfony应用程序和Payum错误地认为用户从未付款。
Payum实际需要哪些配置才能从Paypal接收通知?
我的工作流程是:
在步骤2.1中创建的协议详细信息实体包含以下JSON数据:
{
"L_BILLINGAGREEMENTDESCRIPTION0": "blah blah blah",
"PAYMENTREQUEST_0_AMT": "0.00",
"L_BILLINGTYPE0": "RecurringPayments",
"NOSHIPPING": 1,
"PAYMENTREQUEST_0_PAYMENTACTION": "Sale",
"AUTHORIZE_TOKEN_USERACTION": "commit",
"RETURNURL": "https://hostname.tld/payum/capture/AAAAA-BBBBB",
"CANCELURL": "https://hostname.tld/payum/capture/AAAAA-BBBBB?cancelled=1",
"PAYMENTREQUEST_0_NOTIFYURL": "https://hostname.tld/payum/notifier/AAAAAA-BBBBB",
"TOKEN": "EC-NNNNNN",
"TIMESTAMP": "2017-11-20T13:48:58Z",
"CORRELATIONID": "ZZZZZZ",
"ACK": "Success",
"VERSION": "65.1",
"BUILD": "40680762",
"BILLINGAGREEMENTACCEPTEDSTATUS": "1",
"CHECKOUTSTATUS": "PaymentActionNotInitiated",
"CURRENCYCODE": "USD",
"AMT": "0.00",
"SHIPPINGAMT": "0.00",
"HANDLINGAMT": "0.00",
"TAXAMT": "0.00",
"NOTIFYURL": "https://hostname.tld/payum/notifier/XXX-ZZZ",
"INSURANCEAMT": "0.00",
"SHIPDISCAMT": "0.00",
"PAYMENTREQUEST_0_CURRENCYCODE": "USD",
"PAYMENTREQUEST_0_SHIPPINGAMT": "0.00",
"PAYMENTREQUEST_0_HANDLINGAMT": "0.00",
"PAYMENTREQUEST_0_TAXAMT": "0.00",
"PAYMENTREQUEST_0_INSURANCEAMT": "0.00",
"PAYMENTREQUEST_0_SHIPDISCAMT": "0.00",
"PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED": "false",
"PAYMENTREQUESTINFO_0_ERRORCODE": "0",
"EMAIL": "XXX-buyer@YYY.com",
"PAYERID": "XXX",
"PAYERSTATUS": "verified",
"FIRSTNAME": "test",
"LASTNAME": "buyer",
"COUNTRYCODE": "FR"
}
服务器日志显示使用sandbox.paypal.com中的推荐人很好地查询了捕获URL,以便顺利进行。
我没有发生过PayPal调用的通知URL,尽管已经等了几个星期并确认在PayPal方面已经收到了钱(我已经收到了从7欧元/天收集的400欧元)。
我已经确认,如果我使用浏览器打开通知网址,则确实有效。
协议详情的金额确实为零,但我相信这是订阅的预期:付款为零,然后是与实际订阅的另一个协议。
以下是在上面的步骤4中创建的实际定期付款明细:
{
"TOKEN": "EC-NNNNNN",
"DESC": "blah blah blah",
"EMAIL": "XXX-buyer@YYY.com",
"AMT": "6.99",
"CURRENCYCODE": "EUR",
"BILLINGFREQUENCY": "1",
"BILLINGPERIOD": "Day",
"PROFILESTARTDATE": "2017-11-19T23:00:00Z",
"PROFILEID": "I-XXXXX",
"PROFILESTATUS": "ActiveProfile",
"TIMESTAMP": "2017-11-20T13:49:08Z",
"CORRELATIONID": "abcdef0123456789",
"ACK": "Success",
"VERSION": "65.1",
"BUILD": "39206242",
"STATUS": "Active",
"AUTOBILLOUTAMT": "NoAutoBill",
"MAXFAILEDPAYMENTS": "0",
"SUBSCRIBERNAME": "test buyer",
"NEXTBILLINGDATE": "2017-11-20T10:00:00Z",
"NUMCYCLESCOMPLETED": "0",
"NUMCYCLESREMAINING": "0",
"OUTSTANDINGBALANCE": "0.00",
"FAILEDPAYMENTCOUNT": "0",
"TRIALAMTPAID": "0.00",
"REGULARAMTPAID": "0.00",
"AGGREGATEAMT": "0.00",
"AGGREGATEOPTIONALAMT": "0.00",
"FINALPAYMENTDUEDATE": "1970-01-01T00:00:00Z",
"TOTALBILLINGCYCLES": "0",
"SHIPPINGAMT": "0.00",
"TAXAMT": "0.00",
"REGULARBILLINGPERIOD": "Day",
"REGULARBILLINGFREQUENCY": "1",
"REGULARTOTALBILLINGCYCLES": "0",
"REGULARCURRENCYCODE": "EUR",
"REGULARAMT": "6.99",
"REGULARSHIPPINGAMT": "0.00",
"REGULARTAXAMT": "0.00"
}
所以一切看起来都是名义上的,但我没有来自PayPal的付款通知信息。
阅读完所有内容后docs我注意到,在定期付款后,我直接重定向到订阅页面,而不是通过令牌重定向。因此我取代了这个:
return $this->redirect($this->generateUrl('subscription_show', [
'gatewayName' => $token->getGatewayName(),
'billingAgreementId' => $agreement->getId(),
'recurringPaymentId' => $payment->getId(),
]));
使用:
$doneToken = $payum->getTokenFactory()
->createToken('paypal', $payment, 'subscription_show', [
'gatewayName' => $token->getGatewayName(),
'billingAgreementId' => $agreement->getId(),
'recurringPaymentId' => $payment->getId(),
]);
return $this->redirect($doneToken->getTargetUrl());
让我们看看几天之后是否有效。
48小时后,尽管每天都在PayPal活动信息中心进行定期付款,但仍然没有通知。
我可以在日志中看到我去了Paypal两次(基于推荐人)所以一次在付款细节之后和一次经常性付款之后(这直接导致我的网站没有任何UI在paypal上,与首先明确要求确认。)
我不知道我做错了什么。
答案 0 :(得分:0)
我有found out,PayPal不会使用通知网址进行定期付款。
请参阅:How to set an IPN URL for PayPal Recurring Payments using ExpressCheckout?
所以,我需要做的是在静态IPN URL上自己处理IPN。
以下是我的所作所为:
然后,当收到IPN时:
Sync
(将在PayPal上调用GetRecurringPaymentsProfileDetails
API端点)txn_type
为recurring_payment_profile_created
,则向客户发送购买确认电子邮件txn_type
为recurring_payment
,则创建发票并通过电子邮件发送给客户