diff --git a/ghost/members-api/lib/repositories/product/index.js b/ghost/members-api/lib/repositories/product/index.js index ff8afb1dad..7876e4577c 100644 --- a/ghost/members-api/lib/repositories/product/index.js +++ b/ghost/members-api/lib/repositories/product/index.js @@ -217,13 +217,19 @@ class ProductRepository { interval: existingPrice.interval }, options); } else { - await this._StripePrice.edit({ + const updated = await this._StripePrice.edit({ nickname: existingPrice.nickname, - description: existingPrice.description + description: existingPrice.description, + active: existingPrice.active }, { ...options, id: stripePrice.id }); + + await this._stripeAPIService.updatePrice(updated.get('stripe_price_id'), { + nickname: updated.get('nickname'), + active: updated.get('active') + }); } } diff --git a/ghost/members-api/lib/services/stripe-api/index.js b/ghost/members-api/lib/services/stripe-api/index.js index 985ec9ed98..04c8967c2d 100644 --- a/ghost/members-api/lib/services/stripe-api/index.js +++ b/ghost/members-api/lib/services/stripe-api/index.js @@ -118,6 +118,24 @@ module.exports = class StripeAPIService { return price; } + /** + * @param {string} id + * @param {object} options + * @param {boolean} options.active + * @param {string} options.nickname + * + * @returns {Promise} + */ + async updatePrice(id, options) { + await this._rateLimitBucket.throttle(); + const price = await this._stripe.prices.update(id, { + active: options.active, + nickname: options.nickname + }); + + return price; + } + /** * ensureProduct. *