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

查看:22
本文介绍了设置 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 是:XXXXXXXXXXXXXX.

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他们完成付款.注意:贝宝会检查您输入的返回 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

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天全站免登陆