dongtuo3530 2011-02-23 11:58
浏览 434
已采纳

PayPal API错误 - 处理付款时出错

I know this is a pretty specific question but I managed to get some great help before. I have already posted this on PayPal's developer site (www.x.com) however have not yet had a responce.

I have been attempting to create a PayNow button using the BMCreateButton API via NVP. I receive the success message and the button code, however whenever anyone clicks the button they are instantly displaying the message:

"Error Processing Payment
Your payment can't be processed. Please contact the merchant directly with this code."

The code I am using to generate the button is as follows:

$sendData = array(
    "METHOD" => "BMCreateButton",
    "VERSION" => "65.2",
    "USER" => "[username]",
    "PWD" => "[password]",
    "SIGNATURE" => "[signature]",
    "BUTTONCODE" => "ENCRYPTED",
    "BUTTONTYPE" => "PAYMENT",
    "BUTTONSUBTYPE" => "SERVICES",
    "BUTTONCOUNTRY" => "GB",
    "BUTTONIMAGE" => "reg",
    "L_BUTTONVAR1" => "item_number=$userID",
    "L_BUTTONVAR2" => "item_name=$invoiceID",
    "L_BUTTONVAR3" => "subtotal=$invoiceTotal",
    "L_BUTTONVAR4" => "currency_code=GBP",
    "L_BUTTONVAR5" => "no_shipping=1",
    "L_BUTTONVAR6" => "no_note=1",
    "L_BUTTONVAR7" => "notify_url=[full url to ipn]",
    "L_BUTTONVAR8" => "cancel_return=[full url to cancel]",
    "L_BUTTONVAR9" => "return=[full url to return]"
    );


$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_URL, 'https://api-3t.sandbox.paypal.com/nvp?'.http_build_query($sendData));

$nvpReturn = curl_exec($curl);
curl_close($curl);

The outcome I really want is so that I am able to create a button on the fly for each of our users invoices which can vary in amount (i.e. with late fees, adddons etc).

Just wondering if anyone with some PayPal NVP API experience can spot the issue.

Thanks :)

  • 写回答

2条回答 默认 最新

  • dongyongyin5339 2011-03-01 14:12
    关注

    I actually found the answer by messing with values for hours until finally one worked. This was eventually confirmed by PayPal on www.x.com.

    The following changes were made:

    "BUTTONTYPE" => "PAYMENT", to "BUTTONTYPE" => "BUYNOW",

    and

    "L_BUTTONVAR3" => "subtotal=$invoiceTotal", to "L_BUTTONVAR3" => "amount=$invoiceTotal",

    Apparently the options I had used were for their hosted payment / cart payment methods (not that these are mentioned anywhere in their documentation).

    Never mind, got there in the end.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)