mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-18 02:21:47 -05:00
Ensured latest subscription data is always stored (#240)
no-issue If we receive webhooks out of order, e.g. a `customer.subscription.updated` with a status of 'active', followed by a `customer.subscription.created` with a status of 'incomplete'. We would overwrite the correct value with data from the "older" webhook. This ensures that we always fetch the latest data from the Stripe API before storing in the database.
This commit is contained in:
parent
8b3cd5499c
commit
991b6e92a3
1 changed files with 1 additions and 1 deletions
|
@ -169,7 +169,7 @@ module.exports = class MemberRepository {
|
|||
throw new Error('Subscription is not associated with a customer for the member');
|
||||
}
|
||||
|
||||
const subscription = data.subscription;
|
||||
const subscription = await this._stripeAPIService.getSubscription(data.subscription.id);
|
||||
let paymentMethodId;
|
||||
if (!subscription.default_payment_method) {
|
||||
paymentMethodId = null;
|
||||
|
|
Loading…
Add table
Reference in a new issue