【发布时间】:2016-10-04 15:14:09
【问题描述】:
所以我使用节点 paypal-rest-sdk 模块,我正在尝试创建一个计费计划。使用文档here 我制作了这个 JSON:
const billingPlanAttributes = {
name: 'Subscription',
description: 'Monthly subscription plan',
type: 'INFINITE',
payment_definitions: [{
name: 'Regular monthly infinite payments',
type: 'REGULAR',
frequency_interval: '1',
frequency: 'MONTH',
cycles: '0',
amount: {
currency: 'USD',
amount: '4.99',
},
}],
merchant_preferences: {
cancel_url: 'http://localhost:3000/subscribe/cancel',
return_url: 'http://localhost:3000/subscribe/return',
auto_bill_amount: 'YES',
},
};
但是当使用paypal.billingPlan.create(... 函数时,我得到了错误'MALFORMED_REQUEST', 'Incoming JSON request does not map to API request'。所以我猜我的 JSON 格式不正确,或者我缺少一些需要的东西。
文档有一个charge_models 键,但它没有提到它与其他键不同是必需的。
如果你能指出我正确的方向,那就太好了。
编辑:更改了返回 url 并取消 url 以包含完整的域,但仍然是相同的错误。
【问题讨论】:
标签: javascript node.js paypal paypal-rest-sdk