0
我正尝试在条带连接管理帐户上创建订阅计划。我需要一些帮助来弄清楚这一点。我尝试了下面的代码。我如何在条纹连接的帐户上创建订阅计划
Parse.Cloud.define("createSubscription", function (request, response) {
Parse.Cloud.httpRequest({
method:"POST",
url: "https://" + "sk_test_****************" + ':@' + "api.stripe.com/v1" + "/accounts/" + 'acct_**********' + "/plans/",
headers: {
'Authorization': 'Basic ********************'
},
body: {
'amount': 2000,
'interval': 'month',
'name': 'JPGB Plan',
'currency': 'usd',
'id':'first Plan',
},
success: function(httpResponse) {
response.success(httpResponse.text);
},
error: function(httpResponse) {
response.error('Request failed with response code' + httpResponse.status);
}
});
});
但是,这失败了一个404(所请求的资源不存在。)错误。
这就是我做到的。
Parse.Cloud.define("createAccountPlan", function (request, response) {
Parse.Cloud.httpRequest({
method:"POST",
url: "https://" + "sk_test_****************" + ':@' + "api.stripe.com/v1/plans",
headers: {
'Stripe-Account': request.params.accountId
},
body: {
'amount': request.params.amount,
'interval': 'day',
'interval_count':request.params.intervalCount,
'name': request.params.planName,
'currency': 'usd',
'id':request.params.planId,
},
success: function(httpResponse) {
response.success(httpResponse.text);
},
error: function(httpResponse) {
response.error('Request failed with response code' + httpResponse.status);
}
});
});
感谢您的回复 –
只需添加到冉的答案,因为你使用的条纹连接,你PROBA公司保持bly需要在调用stripe.subscriptions.create()时添加一个额外的“stripe_account”参数,以识别连接的帐户。 –