PayPal:将电子邮件地址传递给返回/“谢谢"邮件地址.页

编程入门 行业动态 更新时间:2024-10-27 09:32:23
本文介绍了PayPal:将电子邮件地址传递给返回/“谢谢"邮件地址.页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经使用 PayPal IPN和一个监听器.该按钮本身是向导生成的.

I've successfully created a small "pay now" button with PayPal IPN and a listener. The button itself is wizard-generated.

付款后,用户将重定向到我的主机上的退货/谢谢"页面.

After the payment, the user is redirected to a return/"thank you" page on my host.

一切正常,但是我也需要在谢谢"页面上收到客户的电子邮件:我该怎么办?

Everything works as expected, but I need to receive the customer e-mail on the "thank you" page too: how can I do that?

推荐答案

您可以使用付款数据传输"(PDT)获取用户电子邮件,该数据发送一个名为tx的GET变量到您的重定向URL.

You can get the user email using the Payment Data Transfer (PDT), which sends a GET variable named tx to your redirect url.

tx变量包含一个交易号,您可以使用该交易号将其发送到贝宝服务器的过帐请求并检索交易信息.

The tx variable contains a transaction number which you can use to send to a post request to Paypal's server and retrieve the transaction information.

我上次使用PDT是一年前的,但是我相信您的Paypal帐户中需要启用并设置重定向网址才能使设置正常工作.

The last time I used PDT was a year ago, but I believe there is a setting in your Paypal account that you need to enable and set a redirect url for this to work.

以下是一些链接,它们更详细地描述了PDT:

Here are some links that describes PDT in further detail:

  • www.paypal/us/cgi-bin/webscr?cmd=p/xcl/rec/pdt-techview-outside
  • cms.paypal /us/cgi-bin/?cmd = _render-content& content_ID = developer/howto_html_paymentdatatransfer
  • www.paypal/us/cgi-bin/webscr?cmd=p/xcl/rec/pdt-techview-outside
  • cms.paypal/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_html_paymentdatatransfer

这里是如何解析向Paypal发送发帖请求并解析数据的示例.我只是从一个旧文件中挖出来的.因此,不能保证它会起作用.这是基于Paypal用作php示例的脚本的.您可以改用curl,那可能是更好的选择.我认为使用fsockopen存在某种安全性问题.

Here is an example of how to parse send a post request to Paypal and parse the data. I just dug this up from an old file. So no guarantees that it works. This is based off a script that Paypal uses as an example for php. You can use curl instead, and that's probably the better choice. I think there is some kind of security issue with using fsockopen.

//Paypal will give you a token to use once you enable PDT $auth_token = 'token'; //Transaction number $tx_token = $_GET['tx']; $payPalUrl = ( $dev === true ) ? 'ssl://www.sandbox.paypal' : 'ssl://www.paypal'; $req = 'cmd=_notify-synch'; $req .= "&tx=$tx_token&at=$auth_token"; $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = fsockopen ($payPalUrl, 443, $errno, $errstr, 30); $keyarray = false; if ( $fp ) { fputs ($fp, $header . $req); $res = ''; $headerdone = false; while (!feof($fp)) { $line = fgets ($fp, 1024); if (strcmp($line, "\r\n") == 0) { $headerdone = true; } else if ($headerdone) { $res .= $line; } } $lines = explode("\n", $res); if (strcmp ($lines[0], "SUCCESS") == 0) { //If successful we can now get the data returned in an associative array $keyarray = array(); for ($i=1; $i<count($lines);$i++){ list($key,$val) = explode("=", $lines[$i]); $keyarray[urldecode($key)] = urldecode($val); } } } fclose ($fp); return $keyarray;

更多推荐

PayPal:将电子邮件地址传递给返回/“谢谢"邮件地址.页

本文发布于:2023-10-13 00:34:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1486306.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:邮件地址   电子邮件地址   PayPal   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!