【发布时间】:2016-06-16 07:53:12
【问题描述】:
我在构建我的小玩具支付网关表单时遇到此错误,但现在我意识到在克隆存储库 here 后我什至无法正确运行 示例代码。
我已在 configure.js 中输入了我的客户端 ID 和密码。我处于沙盒模式。
我正在运行的文件:
var create_payment_json = {
"intent": "sale",
"payer": {
"payment_method": "credit_card",
"funding_instruments": [{
"credit_card": {
"type": "visa",
"number": "4417119669820331",
"expire_month": "11",
"expire_year": "2018",
"cvv2": "874",
"first_name": "Joe",
"last_name": "Shopper",
"billing_address": {
"line1": "52 N Main ST",
"city": "Johnstown",
"state": "OH",
"postal_code": "43210",
"country_code": "US"
}
}
}]
},
"transactions": [{
"amount": {
"total": "7.00",
"currency": "USD",
"details": {
"subtotal": "5.00",
"tax": "1.00",
"shipping": "1.00"
}
},
"description": "This is the payment transaction description."
}]
};
paypal.payment.create(create_payment_json, function (error, payment) {
if (error) {
console.log(error);
throw error;
} else {
console.log("Create Payment Response");
console.log(payment);
}
});
跑步时,我得到
> node create_with_credit_card.js
{ [Error: Response Status : 400]
response:
{ name: 'UNKNOWN_ERROR',
message: 'An unknown error has occurred',
information_link: 'https://developer.paypal.com/webapps/developer/docs/api/#UNKNOWN_ERROR',
debug_id: '599dd3222e6fb',
httpStatusCode: 400 },
httpStatusCode: 400 }
C:\cygwin64\home\Ryan\PayPal-node-SDK\samples\payment\create_with_credit_card.js:47
throw error;
^
Error: Response Status : 400
at IncomingMessage.<anonymous> (C:\cygwin64\home\Ryan\PayPal-node-SDK\lib\client.js:136:23)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
at process._tickCallback (node.js:442:13)
我迫切地想知道我哪里出了问题。
【问题讨论】:
标签: node.js paypal paypal-rest-sdk