Node.js 未使用Paypal rest API显示付款详细信息
请看下面的截图 我正在使用贝宝RESTAPI。现在,你看,没有数量出现。但我已经按照贝宝的文件要求提供了所有细节。你能告诉我如何使它工作吗Node.js 未使用Paypal rest API显示付款详细信息,node.js,paypal,meteor,Node.js,Paypal,Meteor,请看下面的截图 我正在使用贝宝RESTAPI。现在,你看,没有数量出现。但我已经按照贝宝的文件要求提供了所有细节。你能告诉我如何使它工作吗 现在,你不认为这会对paypal提出一个严肃的问题吗?例如,网站所有者可以在网站上显示不同的定价,并在paypal上扣除不同的金额,因为付款信息在paypal的网站上根本看不到。这就是我创建paypal付款(服务器端)并使用REST API显示产品信息所做的。当然,这不会处理付款 注意:不要忘记添加HTTP包 Meteor.methods({ 'cre
现在,你不认为这会对paypal提出一个严肃的问题吗?例如,网站所有者可以在网站上显示不同的定价,并在paypal上扣除不同的金额,因为付款信息在paypal的网站上根本看不到。这就是我创建paypal付款(服务器端)并使用REST API显示产品信息所做的。当然,这不会处理付款 注意:不要忘记添加HTTP包
Meteor.methods({
'createPaypalPayment': function(product) {
var payment, res, token;
token = Meteor.call('getPaypalToken');
payment = {
intent: 'sale',
payer: {
payment_method: 'paypal'
},
redirect_urls: {
return_url: 'http://localhost:3000/dashboard/payment/paypal/execute',
cancel_url: 'http://localhost:3000/dashboard'
},
transactions: [
{
item_list: {
'items': [
{
'name': product.name,
'price': product.price,
'currency': 'USD',
'quantity': 1
}
]
},
amount: {
total: product.price,
currency: 'USD'
},
description: product.description
}
]
};
res = Meteor.http.post('https://api.sandbox.paypal.com/v1/payments/payment', {
headers: {
Authorization: 'Bearer ' + token.access_token,
'Content-Type': 'application/json'
},
data: payment
});
res.data['userId'] = this.userId;
PaypalPayments.insert(res.data);
return res.data;
}
});
这就是我创建paypal支付(服务器端)并使用RESTAPI显示产品信息所做的。当然,这不会处理付款 注意:不要忘记添加HTTP包
Meteor.methods({
'createPaypalPayment': function(product) {
var payment, res, token;
token = Meteor.call('getPaypalToken');
payment = {
intent: 'sale',
payer: {
payment_method: 'paypal'
},
redirect_urls: {
return_url: 'http://localhost:3000/dashboard/payment/paypal/execute',
cancel_url: 'http://localhost:3000/dashboard'
},
transactions: [
{
item_list: {
'items': [
{
'name': product.name,
'price': product.price,
'currency': 'USD',
'quantity': 1
}
]
},
amount: {
total: product.price,
currency: 'USD'
},
description: product.description
}
]
};
res = Meteor.http.post('https://api.sandbox.paypal.com/v1/payments/payment', {
headers: {
Authorization: 'Bearer ' + token.access_token,
'Content-Type': 'application/json'
},
data: payment
});
res.data['userId'] = this.userId;
PaypalPayments.insert(res.data);
return res.data;
}
});
-经常性付款
如果你费心去读这个问题,你会发现这一点
唯一的解决方案是回到Paypal的老派API,因为新的RESTful Paypal API在涉及定期付款时破坏了此功能
如果您想解决此问题,请随时与他们联系。-定期-付款
如果你费心去读这个问题,你会发现这一点
唯一的解决方案是回到Paypal的老派API,因为新的RESTful Paypal API在涉及定期付款时破坏了此功能
如果您希望修复此问题,请随时与他们联系。您必须正确发送包含所有详细信息的请求。需要查看您发送以验证的请求的示例。var samplePaymentObject={“intent”:“sale”,“redirect_url”:{“return_url”:““cancel_url”:“}”,payer:{“payment_method”:“paypal”},“transactions”:[{“amount”:{“total”:余额,“currency”:“USD”},“description”:“这是支付事务描述。”}]};PAYPAL_API.payment.create(samplePaymentObject,{},回调);我认为上面的文本不可读。您可以在此处阅读代码,您一定没有正确发送包含所有详细信息的请求。需要查看您发送的请求的示例以进行验证。var samplePaymentObject={“intent”:“sale”,“redirect_url”:{“return_url”:“cancel_url”:“},“payer”:{”payment_method“:“paypal”},“transactions”:[{“amount”:{“total”:余额,“currency”:“USD”},“description”:“这是支付事务描述”。}]};paypal_API.payment.create(samplePaymentObject,{},回调);我认为上面的文字不可读。你可以在这里阅读代码嘿,朱利安-谢谢你的回复。项目列表似乎不起作用,因为每当我发送项目列表时,它都会抛出一个错误。抛出的错误是什么?(你应该在响应API中看到一条错误消息)如果您想传递行项目,您还需要添加一个details对象来表示金额-请参阅:下面是一个示例:同样,一种不同的格式,它表示将发送到端点的HTTP有效负载请记住,使用localhost返回和取消URL将不起作用。触发这些内容时,将是使用该值的PayPal服务器e、 如果PayPal的服务器重定向到localhost,它将重定向到自身,您很可能会在那里遇到404错误。嘿,Julien-感谢您的回复。项目列表似乎不起作用,因为每当我发送项目列表时,它都会抛出一个错误。抛出的错误是什么?(您应该在响应API中看到一条错误消息)如果您想传递行项目,您还需要添加一个details对象来表示金额-请参阅:下面是一个示例:同样,一种不同的格式,它表示将发送到端点的HTTP有效负载请记住,使用localhost返回和取消URL将不起作用。触发这些内容时,将是使用该值的PayPal服务器e、 如果PayPal的服务器重定向到localhost,它将重定向到自身,您很可能会在那里遇到404错误。