【发布时间】:2014-12-05 15:39:45
【问题描述】:
我的返回 URL 不适用于 paypi-rest-sdk 和 NodeJS。
付款后页面:https://space.zeo.net/g/2x2n1
页面应该是:http://www.mywebsite.fr/confirm
var payment = {
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
"redirect_urls": {
"return_url": paypalConfigs.returnUrl,
"cancel_url": paypalConfigs.cancelUrl+request.user.id
},
"transactions": [{
"amount": {
"total": total,
"currency": "EUR"
},
"description": "Commande Printwithlove"
}]
};
paypal.payment.create(payment, function (error, payment) {
if (error) {
console.log(error);
} else {
if(payment.payer.payment_method === 'paypal') {
request.session.paymentId = payment.id;
var redirectUrl;
for(var i=0; i < payment.links.length; i++) {
var link = payment.links[i];
if (link.method === 'REDIRECT') {
redirectUrl = link.href;
}
}
response.redirect(redirectUrl);
}
}
});
【问题讨论】:
-
您是否在您的 PayPal 账户中开启了“自动退货”功能?您可以在登录 PayPal 后访问此 URL 以打开此功能:paypal.com/us/cgi-bin/webscr?cmd=_profile-website-payments
-
我做了...我遇到了同样的问题...
标签: node.js paypal paypal-rest-sdk