Node.js paypal无效的否定测试输入
我尝试使用paypal rest sdk和基于 Hier是我的代码实现:Node.js paypal无效的否定测试输入,node.js,paypal,paypal-sandbox,paypal-ipn,paypal-rest-sdk,Node.js,Paypal,Paypal Sandbox,Paypal Ipn,Paypal Rest Sdk,我尝试使用paypal rest sdk和基于 Hier是我的代码实现: config.headers = { "PayPal-Mock-Response": {"mock_application_codes":"INSTRUMENT_DECLINED"} } paypal.payment.execute(paymentId, data, config, function (error, payment) { if (error) { console.log(error.re
config.headers = {
"PayPal-Mock-Response": {"mock_application_codes":"INSTRUMENT_DECLINED"}
}
paypal.payment.execute(paymentId, data, config, function (error, payment) {
if (error) {
console.log(error.response);
} else {
// success code
}
}});
但是,我得到了以下错误:
{ name: 'SIMULATION_FRAMEWORK_INVALID_NEGATIVE_TESTING_INPUT',message:'Invalid input found. See the following supported cases.',links: [ { href: 'https://developer.paypal.com/docs/api/nt-rest/',rel: 'information_link' } ],details: [ { issue: 'You must have valid input.' } ],httpStatusCode: 400 }
谁能帮我一下我的代码出了什么问题
非常感谢您必须将对象字符串化:
headers: {
'PayPal-Mock-Response': JSON.stringify({
"mock_application_codes":"CANNOT_PAY_SELF"
})
},
你有没有想过?