0

以下代码基于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);

它是自定义模块代码的一部分并实现hook_webform_submission_insert(). 提交表单时,$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.

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

我期待被带到一个贝宝登录表单,但只是得到了错误。

是否可以以这种方式将数据传递给贝宝?(直接在网址中,而不是通过表单“发布”)

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

编辑- 丢失了currency_code。因为添加了它并且仍然收到错误。

4