gpt4 book ai didi

paypal - 设置 PayPal 返回 URL 并使其自动返回?

转载 作者:太空宇宙 更新时间:2023-11-03 15:38:32 25 4
gpt4 key购买 nike

这是一个跟进问题:PHP: Easy way to start PayPal checkout?

所以,我的问题是我指定了返回 url。但是,在使用 PayPal 付款后,我最终会看到一个显示以下内容的屏幕:

You just completed your payment. XXXX, you just completed your payment. Your transaction ID for this payment is: XXXXXXXXXXXXX.

We'll send a confirmation email to XX@XXXX.com. This transaction will appear on your statement as PAYPAL.

Go to PayPal account overview

我需要它不显示此屏幕并直接转到返回 URL。我有:

  • 设置“返回”变量
  • 将“rm”变量设置为:2(根据指南 =“使用 POST 方法将买家的浏览器重定向到返回 URL,并且包括所有付款变量”)

事实上,这是我的整个表格:

<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
<input type="hidden" value="_xclick" name="cmd">
<input type="hidden" value="onlinestore@thegreekmerchant.com" name="business">
<!-- <input type="hidden" name="undefined_quantity" value="1" /> -->
<input type="hidden" value="Order at The Greek Merchant:&lt;Br /&gt;Goldfish Flock BLG&lt;br /&gt;" name="item_name">
<input type="hidden" value="NA" name="item_number">
<input type="hidden" value="22.16" name="amount">
<input type="hidden" value="5.17" name="shipping">
<input type="hidden" value="0" name="discount_amount">
<input type="hidden" value="0" name="no_shipping">
<input type="hidden" value="No comments" name="cn">
<input type="hidden" value="USD" name="currency_code">
<input type="hidden" value="http://XXX/XXX/XXX/paypal/return" name="return">
<input type="hidden" value="2" name="rm">
<input type="hidden" value="11255XXX" name="invoice">
<input type="hidden" value="US" name="lc">
<input type="hidden" value="PP-BuyNowBF" name="bn">
<input type="submit" value="Place Order!" name="finalizeOrder" id="finalizeOrder" class="submitButton">
</form>

知道如何让它自动返回吗?或者,如何将付款结果返回到我的网站以便更新数据库?什么是 IPN?

最佳答案

您必须在您的 PayPal 帐户中启用自动返回,否则它将忽略 return 字段。

来自文档(已更新以反射(reflect) 2019 年 1 月的新布局):

Auto Return is turned off by default. To turn on Auto Return:

  1. Log in to your PayPal account at https://www.paypal.com or https://www.sandbox.paypal.com The My Account Overview page appears.
  2. Click the gear icon top right. The Profile Summary page appears.
  3. Click the My Selling Preferences link in the left column.
  4. Under the Selling Online section, click the Update link in the row for Website Preferences. The Website Payment Preferences page appears
  5. Under Auto Return for Website Payments, click the On radio button to enable Auto Return.
  6. In the Return URL field, enter the URL to which you want your payers redirected after they complete their payments. NOTE: PayPal checks the Return URL that you enter. If the URL is not properly formatted or cannot be validated, PayPal will not activate Auto Return.
  7. Scroll to the bottom of the page, and click the Save button.

IPN 用于即时付款通知。与自动返回相比,它会为您提供更可靠/有用的信息。

IPN 的文档在这里:https://www.x.com/sites/default/files/ipnguide.pdf

IPN 在线文档:https://developer.paypal.com/docs/classic/ipn/gs_IPN/

一般的程序是你通过请求传递一个notify_url参数,并设置一个页面来处理和验证IPN通知,PayPal会向该页面发送请求以在付款时通知你/退款/等。经过。该 IPN 处理程序页面将成为更新数据库以将订单标记为已支付的正确位置。

关于paypal - 设置 PayPal 返回 URL 并使其自动返回?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7642895/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com