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

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

问题描述

这是针对以下问题的后续问题: PHP:简便的方法开始PayPal结帐?

This is a follow up question to: PHP: Easy way to start PayPal checkout?

所以,我的问题是我指定了返回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,并且包括所有付款变量")
  • Set the "return" variable
  • Set the "rm" variable to: 2 (which according to the guide = "the buyer’s browser is redirected to the return URL by using the POST method, and all payment variables are included")

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

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.com
  2. 点击右上角的齿轮图标. 出现概要摘要"页面.
  3. 点击左侧栏中的我的销售偏好"链接.
  4. 在在线销售"部分下,单击网站偏好设置"行中的更新"链接. 出现网站付款首选项"页面
  5. 在网站付款的自动退还"下,单击启用"单选按钮以启用自动" 返回.
  6. 在返回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/sites/default/files/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/

Online Documentation for IPN: https://developer.paypal.com/docs/classic/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返回网址并使其自动返回?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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