【发布时间】:2014-02-26 08:24:36
【问题描述】:
我在调试我的贝宝与 Node 和其余 api https://github.com/paypal/rest-api-sdk-nodejs 的集成时遇到问题
- 我创建了一个 Paypal 帐户
- 我获得了该应用的信用证
- 我创建了一个应用并为用户设置了密码
- 我使用该用户登录沙盒
- 我没有看到任何交易记录
sn-p代码如下:
var config_opts = {
'host': 'api.sandbox.paypal.com',
'port': '',
'client_id': 'my id',
'client_secret': 'my secret'
};
var create_payment_json = {
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
"redirect_urls": {
"return_url": "http://localhost:3000",
"cancel_url": "http://localhost:3000"
},
"transactions": [{
"amount": {
"currency": "USD",
"total": "10.00"
},
"description": "This is the payment description."
}]
};
paypal_sdk.payment.create(create_payment_json, config_opts, function (err, res) {
if (err) {
console.log( err );
}
if (res) {
console.log("Create Payment Response");
console.log(res);
}
});
我得到的回复如下:
{ id: 'PAY-55J119327J2030636KLXMVJI',
create_time: '2014-02-02T22:45:57Z',
update_time: '2014-02-02T22:45:57Z',
state: 'created',
intent: 'sale',
payer:
{ payment_method: 'paypal',
payer_info: { shipping_address: {} } },
transactions:
[ { amount: [Object],
description: 'This is the payment description.' } ],
links:
[ { href: 'https://api.sandbox.paypal.com/v1/payments/payment/PAY- 55J119327J2030636KLXMVJI',
rel: 'self',
method: 'GET' },
{ href: 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-90D3081342725343U',
rel: 'approval_url',
method: 'REDIRECT' },
{ href: 'https://api.sandbox.paypal.com/v1/payments/payment/PAY-55J119327J2030636KLXMVJI/execute',
rel: 'execute',
method: 'POST' } ] }
我想知道是否有一些额外的步骤来验证我缺少的东西?
【问题讨论】:
-
更新:我可以在developer.paypal.com 上看到我的交易,但在我的沙盒帐户中看不到。贝宝是否改变了沙盒的工作方式?
标签: node.js paypal paypal-sandbox