我正在使用 PayPal 支付 API 转账,它在沙盒环境中完美运行,但是当我将其更改为实时环境时,它会抛出一些错误:
text: '{"name":"VALIDATION_ERROR","message":"无效请求 - 查看详细信息","debug_id":"a641429b40e07","information_link":"https://developer.paypal.com/docs/api /payments.payouts-batch/#errors","details":[{"field":"items[0].receiver","location":"body","issue":"可能不为空"}] ,“链接”:[]}'
这是我用来请求付款的代码
let requestBody = {
"sender_batch_header": {
"recipient_type": "EMAIL",
"email_message": "SDK payouts test txn",
"note": "Enjoy your Payout!!",
"sender_batch_id": 'asd12432',
"email_subject": "This is a test transaction from SDK"
},
"items": [{
"note": "Your 5$ Payout!",
"amount": {
"currency": "USD",
"value": 20
},
"receiver": 'payment@reciever.com',
"sender_item_id": "Test_txn_1"
}]
}
// Construct a request object and set desired parameters
// Here, PayoutsPostRequest() creates a POST request to /v1/payments/payouts
let request = new paypal.payouts.PayoutsPostRequest();
request.requestBody(requestBody);
// Call API with your client and get a response for your call
let createPayouts = async function () {
let response = await client.execute(request);
console.log(`Response: ${JSON.stringify(response.statusCode)}`);
// If caladfl returns body in response, you can get the deserialized version from the result attribute of the response.
console.log(`Payouts Create Response: ${JSON.stringify(response.result)}`);
//res.redirect('/adam?payment=success');
res.redirect('/adam?payment=success');
}
createPayouts();