PayPal无效的负测试输入



我尝试使用 rest sdk 和 nodejs 模拟负面测试 PayPal 基于这里

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.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"
})
},

最新更新