Paypal NVP 与 IPN 进行确认 - 是什么将它们联系在一起
我使用 PayPal 和 NVP API(使用 PHP)进行快速结账。在将用户重定向到 Paypal 之前,我正在数据库中创建发票记录。如果用户在处理后没有返回我的网站,我将使用 IPN 确认购买,然后更新发票记录以确认付款。我仍处于沙盒模式,并试图弄清楚如何将使用 NVP 启动的交易与通过 IPN 获得的确认联系起来。
我需要验证 NVP 中发送的“PAYMENTREQUEST_n_INVNUM”是否会在 IPN 帖子中作为“发票”返回。
看起来我在上线之前无法实际测试这一点,因为沙箱 IPN 似乎对于 NVP 发起的沙箱交易并不活跃 - 这是正确的吗?
感谢您的帮助。
I am using PayPal with NVP API (using PHP) for express checkout. I am creating an invoice record in the database before redirecting the user to Paypal. In case the user doesn't return to my site after processing, I am using IPN to confirm the purchase and then update the invoice record that the payment is confirmed. I am still in the sandbox mode and trying to figure out how I will tie the transaction started with NVP to the confirmation I get with IPN.
I need to verify if the "PAYMENTREQUEST_n_INVNUM" sent in the NVP will come back as "invoice" in the IPN post.
It appears I cannot actually test this until I am live since the Sandbox IPN does not seem to be active with NVP initiated sandbox transactions - is this correct?
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在沙盒中对此进行测试。但如果您使用的是“PayPal NVP”,我假设您使用的是 PayPal Express Checkout 并调用
SetExpressCheckout
和DoExpressCheckoutPayment
API。如果是这种情况,您实际上并不需要 IPN,因为只有在调用
DoExpressCheckoutPayment
时交易才会完成。换句话说,买家将始终被重定向到您在
SetExpressCheckout
中指定的RETURNURL,并且当您调用DoExpressCheckoutPayment
时交易完成(或未完成) > 在此返回页上。要获取发票号码,您可以调用
GetExpressCheckoutDetails
并提供您之前检索到的 TOKEN(它也附加到 RETURNURL 的 GET 中)。最后,检查
DoExpressCheckoutPayment
API 响应中的PAYMENTSTATUS=Completed
以查看交易是否已完成。You can test this in Sandbox. But if you're using "PayPal NVP", I assume you're using PayPal Express Checkout and calling the
SetExpressCheckout
andDoExpressCheckoutPayment
API's.If that's the case, you don't really need IPN, because a transaction will only be completed as soon as you call
DoExpressCheckoutPayment
.In other words, buyers will always be redirected to the RETURNURL you specified in
SetExpressCheckout
, and the transaction is completed (or not) when you callDoExpressCheckoutPayment
on this return page.To get the invoice number, you could call
GetExpressCheckoutDetails
and supply the TOKEN you retrieved earlier (it's also appended to the GET of the RETURNURL).Finally, check
PAYMENTSTATUS=Completed
in theDoExpressCheckoutPayment
API response to see whether the transaction has completed or not.感谢 Robert 对整个过程的清晰说明 - 特别是 useraction=commit。
我终于意识到我可以在沙盒中为我的测试卖家打开 IPN,并与 IPN 一起测试 NVP。我能够验证 PAYMENTREQUEST_0_INVNUM 是否与 IPN POST 中的“INVOICE”参数匹配。
我将使用自定义字段从我的系统传递客户电子邮件,以防他们使用不同的电子邮件登录贝宝,因此允许我有电子邮件/发票号码对进行确认。
Thank you Robert for the clarity on the process - especially useraction=commit.
I finally realized that I could turn on IPN in the Sandbox for my test seller and test NVP with IPN together. I was able to verify that PAYMENTREQUEST_0_INVNUM matches the 'INVOICE' parameter in the IPN POST.
I will use the custom field to pass customer email from my system in case they use a different email to log into paypal with, therefore allowing me to have email/invoice number pair for confirmation.