设置 PayPal 退货 URL 并使其自动退货? [英] Setting PayPal return URL and making it auto return?

查看:16
本文介绍了设置 PayPal 退货 URL 并使其自动退货?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个后续问题:PHP:简单的方法开始 PayPal 结帐?

所以,我的问题是我指定了返回 url.但是,在使用 PayPal 付款后,我最终会看到一个屏幕,上面写着:

So, my problem is that I am specifying the return url. However, after paying with PayPal, I end up at a a screen that says:

您刚刚完成付款.XXXX,您刚刚完成付款.您的这笔付款的交易 ID 是:XXXXXXXXXXXXX.

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

我们将向 XX@XXXX.com 发送一封确认电子邮件.此交易将在您的对帐单上显示为 PAYPAL.

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.我有:

I need it to not show this screen and go directly to the return URL. I have:

  • 设置返回"变量
  • 设置rm"变量为:2(根据指南=买家浏览器通过POST方式重定向到返回URL,并包含所有支付变量")

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

In fact, here's my whole form:

<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?

Any idea how I can get it to automatically go back? Alternatively, how do I get the result of the payment back to my website so I can update the database? What is IPN?

推荐答案

您必须在您的 PayPal 帐户中启用自动退货,否则它将忽略 return 字段.

You have to enable auto return in your PayPal account, otherwise it will ignore the return field.

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

From the documentation (updated to reflect new layout Jan 2019):

默认情况下自动返回是关闭的.要打开自动返回:

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

  1. https://www.paypal.comhttps://www.sandbox.paypal.com出现我的帐户概览"页面.
  2. 点击右上角的齿轮图标.将显示配置文件摘要页面.
  3. 点击左侧栏中的我的销售偏好"链接.
  4. 在在线销售"部分下,点击网站偏好"行中的更新"链接.出现网站付款首选项"页面
  5. 在网站付款的自动退货下,点击开启单选按钮以启用自动返回.
  6. 在返回 URL"字段中,输入您希望付款人在之后重定向到的 URL他们完成付款.注意:PayPal 会检查您输入的退货 URL.如果 URL 格式不正确或无法验证,PayPal 将不会激活自动退货.
  7. 滚动到页面底部,然后点击保存按钮.
  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 is for instant payment notification. It will give you more reliable/useful information than what you'll get from auto-return.

IPN 的文档在这里:https://www.x.com/站点/默认/文件/ipnguide.pdf

Documentation for IPN is here: https://www.x.com/sites/default/files/ipnguide.pdf

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

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

The general procedure is that you pass a notify_url parameter with the request, and set up a page which handles and validates IPN notifications, and PayPal will send requests to that page to notify you when payments/refunds/etc. go through. That IPN handler page would then be the correct place to update the database to mark orders as having been paid.

这篇关于设置 PayPal 退货 URL 并使其自动退货?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆