【发布时间】:2018-11-17 20:15:00
【问题描述】:
我正在使用 node.js SDK 在沙盒上创建和发送发票。前 8-15 次创建和 0-2 次发送返回此错误:
The requested resource (/v1/invoicing/invoices/) is not available.
发送的不是 JSON,因为有时发票会通过,有时则不会。我想知道这是否是沙盒问题(API 以某种方式受到速率限制),还是我应该事先进行一些初始化?
大致来说,这是我的代码:
paypal.configure ...
program // Commander
.parse(process.argv)
.args.forEach(function (arg) {
fs.createReadStream(arg).pipe(
parse({ columns: true, delimiter: '\t' }, function (error, data) {
data.forEach(function (row) {
// create invoice from each row in data
var invoice = ...
invoice
.setShipping()
.then(
function (invoice) {
return new Promise(function (resolve, reject) {
paypal.invoice.create(invoice, function (error, invoice) {
if (null === error) {
resolve(invoice);
} else {
reject(error);
}
});
});
}
)
.then(
function (invoice) {
paypal.invoice.send( invoice.id, function (error, invoice) {
});
}
);
})
})
);
});
【问题讨论】:
标签: node.js paypal paypal-sandbox