我正在尝试使用
paypal
和 nodejs
实施付款。到目前为止,我正在使用 paypal-rest-sdk
来处理 API 调用。我编写了一个代码,我获取信用卡信息,然后将它们转移到 paypal
,但我得到一个代号为 400 Response Code
的 PAYEE_ACCOUNT_INVALID
。似乎有很多这样的问题,但没有一个人正确地解决了解决方案。
这个案例的原因是什么?这是我要发出的
json
:
// Construct a PayPal payment request
const createPaymentJson = {
intent: 'sale',
payer: {
payment_method: 'credit_card',
funding_instruments: [
{
credit_card: {
number: numericCardNumber, // Use the numeric card number without spaces
type: "mastercard", // Card type (e.g., visa, mastercard), paymentData.cardType
expire_month: paymentData.expiry.split(' / ')[0],
expire_year: '20' + paymentData.expiry.split(' / ')[1], // Properly format the year
cvv2: paymentData.cvv, // CVV code
},
},
],
},
transactions: [
{
amount: {
total: paymentData.amount, // Extract the amount from the request body
currency: paymentData.currency, // Extract the currency from the request body
},
description: paymentData.description, // Extract the description from the request body
},
],
redirect_urls: {
return_url: process.env.PAYPAL_RETURN_URL,
cancel_url: process.env.PAYPAL_CANCEL_URL,
},
};