我没有网站,我只想发送一个链接给用户并获得相应的回复,无论他们是否在PayPal网站上付款并处理其余的。
基本上我不想将用户重定向到任何地方。
配置我的PayPal凭证后,我有以下
var create_payment_json = {
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
// I WANT TO REMOVE THAT BUT IF I DO I GET AN ERROR IN RESPONSE
"redirect_urls": {
"return_url": "http://return.url",
"cancel_url": "http://cancel.url"
},
"transactions": [{
"item_list": {
"items": [{
"name": "item",
"sku": "item",
"price": "1.00",
"currency": "USD",
"quantity": 1
}]
},
"amount": {
"currency": "USD",
"total": "1.00"
},
"description": "This is the payment description."
}]
};
paypal.payment.create(create_payment_json, function (error, payment) {
if (error) {
throw error;
} else {
console.log("Create Payment Response");
console.log(payment);
}
});
var paymentId = 'PAYMENT id created in previous step';
//check if user payed or not
paypal.payment.execute(paymentId, execute_payment_json, function (error, payment) {
if (error) {
console.log(error.response);
throw error;
} else {
console.log("Get Payment Response");
console.log(JSON.stringify(payment));
}
});