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条)

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用