【发布时间】:2021-07-14 05:17:23
【问题描述】:
目前,我将 paypal-rest-api 用于 node.js 并使用 paypal.payment.create()。但是,为此,卖家需要有一个企业帐户,因为您需要在开发者页面上输入来自应用程序的令牌和 Id。
我在其他方法中看到卖家使用他们的电子邮件让客户通过订单/付款方式付款 - 而不是使用令牌和 ID。
为了进一步阐述,目前我必须使用
var paypal = require('paypal-rest-sdk');
paypal.configure({
'mode': 'live', //sandbox or live
'client_id': 'CLIENT_ID',
'client_secret': 'CLIENT_SECRET'
});
但是,在使用的 json 对象中,有一种方法可以让帐户电子邮件付款。例如
var create_payment_json = {
"intent": "sale",
"business": "myemail@gmail.com",
"payer": {
"payment_method": "paypal"
},
"redirect_urls": {
"return_url": `return`,
"cancel_url": `cancel`
},
"transactions": [{
"item_list": {
"items": itemsList
},
"amount": {
"currency": "USD",
"total": total.toFixed(2),
"details": {
"subtotal": subPrice.toFixed(2).toString(),
"tax": "0.00",
"shipping": "0.00",
"discount": sortedDiscount.toFixed(2),
}
},
"description": `Store payment.`
}]
};
提前致谢。
【问题讨论】:
标签: node.js npm paypal paypal-rest-sdk