PayPal:错误-返回商家


PayPal: error - return to merchant

以下代码基于Drupal 7 中Webform PayPal集成的示例

$paypal = array();
$paypal['cmd'] = '_xclick';
$paypal['business'] = variable_get('event_reg_paypal_address');
$paypal['receiver_email'] = $paypal['business'];
$paypal['page_style'] = 'huang_checkout';
$paypal['amount'] = variable_get('event_reg_paypal_cost');
$paypal['currency_code'] = 'GBP';
$paypal['item_name'] = 'Test Event Registration';
$paypal['tax'] = 0;
$paypal['custom'] = $submission->sid;
$paypal['return'] = $base_url.'/test/thanks';
$paypal['notify_url'] = $base_url.'/test/thanks';
$paypal['cancel_return'] = $base_url;
$paypal['first_name'] = //first name from submission
$paypal['country'] = 'UK';
$query = http_build_query($paypal, '', '&');
$url = $paypal_host . $query;
drupal_goto($url);

它是自定义模块代码的一部分,并实现了CCD_ 1。当提交表单时,$url变量是从$paypal数组中构建的,然后用户的浏览器重定向到例如

https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick&business=pete27_11_94-facilitator%40hotmail.com&receiver_email=pete27_11_94-facilitator%40hotmail.com&page_style=huang_checkout&amount=0.01&currency_code=GBP&item_name=Test+Event+Registration&tax=0&custom=24&return=http%3A%2F%2Fwww.pitmart.com%2Fformulak%2Ftest%2Fthanks&notify_url=http%3A%2F%2Fwww.pitmart.com%2Fformulak%2Ftest%2Fthanks&cancel_return=http%3A%2F%2Fwww.pitmart.com%2Fformulak&first_name=sdfgsdfg&country=UK

在我的贝宝开发者帐户中,有一个用户的电子邮件地址与url中的相同,属于business pro类型,但每次我提交时,我都会收到错误消息

We cannot process this transaction because there is a problem with the PayPal email address supplied by the seller. Please contact the seller to resolve the problem. If this payment is for an eBay listing, you can contact the seller via the "Ask Seller a Question" link on the listing page. When you have the correct email address, payment can be made at www.paypal.com.

我正在一个实时服务器上进行测试,而不是无法访问的本地服务器。

我本以为会被带到贝宝登录表单,但却收到了错误。

有可能以这种方式将数据传递给贝宝吗?(直接在url中,而不是通过表单"发布")

我是否遗漏了一些会导致此故障的变量/数据?是否有文档列出了贝宝请求的最低配置?

编辑-缺少currency_code。因为在中添加了该错误,并且仍在接收错误。

问题是您对所有内容进行URL编码,包括用来分隔值的符号。

也就是说,这很好:https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick&business=pete27_11_94-支持者%40hotmail.com&receiver_email=pete27_11_94-联系人%40hotmail.com&page_style=huang_checkout&数量=0.01&currency_code=英镑;item_name=测试+活动+注册&tax=0&custom=24&return=http%3A%2F%2Fwww.pitmart.com%2Fformulak%2Ftest%2Fwens&notify_url=http%3A%2F%2Fww.pitmart.com%2Fformulak%2Ftest%2Fwens&cancel_return=http%3A%2F%2Fwww.pitmart.com%2Fformulak&first_name=sdfgsdfg&country=英国

顺便说一句,"英国"不是一个有效的国家。PayPal国家代码遵循ISO 3166-2,所以应该是"GB"。