🐛 Fixed members importer failing to link paid subscriptions

no refs

The latest version of Stripe doesn't return the `subscriptions` object on `Customer` resource by default and needs an extra param to do so. As we recently updated Members to use the latest Stripe version, the importer tries to fetch all subscriptions of a customer to map in Ghost but was failing due to missing `subscriptions` data. Fix updates the Stripe API to include `subscriptions` by default in response.
This commit is contained in:
Rish 2021-04-22 21:22:23 +05:30
parent 881077ad9d
commit 9010a62d54

View File

@ -216,7 +216,9 @@ module.exports = class MemberRepository {
if (!this._stripeAPIService.configured) {
throw new Error('Cannot link Stripe Customer with no Stripe Connection');
}
const customer = await this._stripeAPIService.getCustomer(data.customer_id);
const customer = await this._stripeAPIService.getCustomer(data.customer_id, {
expand: ['subscriptions']
});
if (!customer) {
return;