Parse platform 我正在使用stipe的解析云模块从stripe中检索客户信息
我正在使用stipe的解析云模块从stripe中检索客户信息 我正在使用的api-Stripe.Customers.retrieve有一个选项“expand”来扩展内联属性以获取整个对象- 这是我的密码-Parse platform 我正在使用stipe的解析云模块从stripe中检索客户信息,parse-platform,Parse Platform,我正在使用stipe的解析云模块从stripe中检索客户信息 我正在使用的api-Stripe.Customers.retrieve有一个选项“expand”来扩展内联属性以获取整个对象- 这是我的密码- Stripe.Customers.retrieve(customerId,{ expand: ["default_card"], success: function(stripeCustomer
Stripe.Customers.retrieve(customerId,{
expand: ["default_card"],
success: function(stripeCustomer){
console.log("GetCreditCardInformationForCustomerStripe: Customer info received: "+JSON.stringify(stripeCustomer));
var creditCardResponse = {
"id" : stripeCustomer.id,
"cardId" : stripeCustomer.default_card.id,
"cardHolderName" : stripeCustomer.default_card.name,
"cardBrand" : stripeCustomer.default_card.brand,
"cardExpMonth" : stripeCustomer.default_card.exp_month,
"cardExpYear" : stripeCustomer.default_card.exp_year,
"cardLast4Digits" : stripeCustomer.default_card.last4,
"cardFundingType" : stripeCustomer.default_card.funding
};
response.success(creditCardResponse);
}, error: function(error){
console.log("getCreditCardInformationForCustomer: Fetch Stripe Customer failed for Stripe customerId: "+customerId);
console.log("error "+JSON.stringify(error));
var error = new Parse.Error(Parse.Error.OTHER_CAUSE, "FetchStipeCustomerFailed");
response.error(error);
}
});
以下是回应
Customer info received:
{
"object": "customer",
"created": 1408129243,
"id": "cus_4b20U8dcPZcQgb",
"livemode": false,
"description": null,
"email": "a.gangal318@gmail.com",
"delinquent": false,
"metadata": {
"name": "Ankit Gangal",
"parseUserId": "undefined"
},
"subscriptions": {
"object": "list",
"total_count": 0,
"has_more": false,
"url": "/v1/customers/cus_4b20U8dcPZcQgb/subscriptions",
"data": [
]
},
"discount": null,
"account_balance": 0,
"currency": null,
"cards": {
"object": "list",
"total_count": 1,
"has_more": false,
"url": "/v1/customers/cus_4b20U8dcPZcQgb/cards",
"data": [
{
"id": "card_14VqYZ28ck1ONXovNwtwPw0k",
"object": "card",
"last4": "4242",
"brand": "Visa",
"funding": "credit",
"exp_month": 4,
"exp_year": 2021,
"fingerprint": "kQf99zmtHwo0T0P2",
"country": "US",
"name": null,
"address_line1": null,
"address_line2": null,
"address_city": null,
"address_state": null,
"address_zip": null,
"address_country": null,
"cvc_check": "pass",
"address_line1_check": null,
"address_zip_check": null,
"customer": "cus_4b20U8dcPZcQgb"
}
]
},
"default_card": "card_14VqYZ28ck1ONXovNwtwPw0k"
}
如您所见,默认的_卡未展开
我尝试了其他组合,如{“expand”:[“customer.default_card”]}等,但没有任何效果,
有人知道怎么做吗
作为一种解决方法,我很幸运地直接从CloudCode使用了API调用,并在URL中传递了“expand”。 “data.source”上带有“expand”的帐户余额获取请求如下所示:
Parse.Cloud.httpRequest({
url: 'https://MY_SECRET_KEY:@api.stripe.com/v1/balance/history?expand[]=data.source',
method: "GET",
headers: {
'Stripe-Account': THE_ACCOUNT_ID,
},
body:{}
}).then(function(httpResponse) {
response.success( httpResponse.data );
},function( error ) {
response.error( error );
});
有更新吗?