我实现了一个Paypal HTML按钮(付款和订阅),将客户定向到Paypal网站进行付款。另外,我将发票编号作为参数传递。根据以下文档,发票是传递变量。
https://developer.paypal.com/docs/paypal-payments-standard/integration-guide/Appx-websitestandard-htmlvariables/# https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/archive/PP_subscriptions.pdf
实际上,在沙盒帐户上进行测试时,我确实将所有参数(包括发票)作为POST调用接收。但是,当我测试实时付款(非沙盒帐户)时,未收到发票。但是,我会收到其他付款信息,例如item_number,custom,transaction id等。此外,对于实时付款,该信息是通过GET调用而不是POST调用传递的。
总而言之,为什么我会从沙盒付款中收到发票参数,而不能从实时付款中收到。
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" class="message">
<input type="hidden" name="return" value="<%= (request.isSecure() ? "https" : "http") + "://" + request.getServerName() + "/upgradepayment" %>">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="hosted_button_id" value="...">
<input type="hidden" name="business" value="...">
<input type="hidden" name="item_name" value="...">
<input type="hidden" name="notify_url" value="..."
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="a3" value="...">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
<input type="hidden" name="invoice" value="...">
<input type="hidden" name="custom" value="...">
<input type="hidden" name="item_number" value="...">
<input id="ok" type="submit" name="submit" value="Pay and Subscribe with PayPal" alt="PayPal - The safer, easier way to pay online" title="PayPal - The safer, easier way to pay online">
</form>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" class="message">
<input type="hidden" value="<%= (request.isSecure() ? "https" : "http") + "://" + request.getServerName() + "/upgradepayment" %>" name="return">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="...">
<input type="hidden" name="item_name" value="...">
<input type="hidden" name="amount" value="...">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="CA">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="hidden" name="invoice" value="...">
<input type="hidden" name="custom" value="...">
<input type="hidden" name="item_number" value="...">
<input id="ok" type="submit" name="submit" value="Pay with PayPal" alt="PayPal - The safer, easier way to pay online" title="PayPal - The safer, easier way to pay online">
</form>
编辑:我收到有关带有即时付款通知(IPN)的订阅的信息
答案 0 :(得分:0)
我刚刚使用以下代码(您的HTML进行了一些修改)进行了实时付款:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" class="message">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<BUSINESS_PAYPAL_EMAIL>">
<input type="hidden" name="item_name" value="<ITEM_NAME>">
<input type="hidden" name="notify_url" value="<CALLBACK_URL>"
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
<input type="hidden" name="invoice" value="<INVOICE_ID>">
<input type="hidden" name="custom" value="<CUSTOM_OPTIONAL>">
<input type="hidden" name="item_number" value="<ITEM_NUMBER>">
<input type="hidden" name="amount" value="<AMOUNT>">
<input id="ok" type="submit" name="submit" value="Pay and Subscribe with PayPal" alt="PayPal - The safer, easier way to pay online" title="PayPal - The safer, easier way to pay online">
</form>
我使用https://requestbin.com/来收集IPN回调。这是发票的屏幕截图:
答案 1 :(得分:0)
确保正确实施了IPN listener request-response flow。
您的听众应该向这些地址返回200空消息给Paypal;
此后,您会收到一条VERIFIED
消息以及参数。
确保在表单中包含invoice
输入(看起来已经完成了)。
发票是可选的,默认为not passed back to you。
还有一个IPN simulator,您可以尝试确保自己的听众正常工作。
以下是有关如何处理IPN消息的完整示例: https://gist.github.com/xcommerce-gists/3440401