From a738f5aacb3eaee3818c9543bba9da49f14ca1c1 Mon Sep 17 00:00:00 2001 From: Ronald Langeveld Date: Wed, 1 May 2024 15:35:25 +0800 Subject: [PATCH 1/2] Added `customer_update` param to StripeAPI (#20105) ref https://linear.app/tryghost/issue/ENG-881/stripe-tax-checkout-instantiation-fails-for-free-members-when-choosing - For existing customers to be able to upgrade their account with automatic tax enabled, we need to pass in `customer_update[address]:auto` as per Stripe documentation. - Automatic tax calculation in Checkout requires a valid address on the Customer. Add a valid address to the Customer or set either 'customer_update[address]' to 'auto' or 'customer_update[shipping]' to 'auto' to save the address entered in Checkout to the Customer. - We update the existing customer details by passing in address `auto` when they upgrade their accounts. - Stripe captures the billing address information by default when new accounts are created and then that is used to calculate the tax rate. --- ghost/stripe/lib/StripeAPI.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ghost/stripe/lib/StripeAPI.js b/ghost/stripe/lib/StripeAPI.js index 009b28e051..68d98fa755 100644 --- a/ghost/stripe/lib/StripeAPI.js +++ b/ghost/stripe/lib/StripeAPI.js @@ -475,6 +475,7 @@ module.exports = class StripeAPI { automatic_tax: { enabled: this._config.enableAutomaticTax }, + customer_update: this._config.enableAutomaticTax ? {address: 'auto'} : {}, metadata, discounts, /* @@ -526,6 +527,7 @@ module.exports = class StripeAPI { automatic_tax: { enabled: this._config.enableAutomaticTax }, + customer_update: this._config.enableAutomaticTax ? {address: 'auto'} : {}, metadata, customer: customer ? customer.id : undefined, customer_email: !customer && customerEmail ? customerEmail : undefined, From a4c478958b0120688e16a4a8db2ed99d819c2b34 Mon Sep 17 00:00:00 2001 From: Ghost CI <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 1 May 2024 13:22:26 +0000 Subject: [PATCH 2/2] v5.82.5 --- ghost/admin/package.json | 2 +- ghost/core/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ghost/admin/package.json b/ghost/admin/package.json index 2c3ffbaaba..64ab06132f 100644 --- a/ghost/admin/package.json +++ b/ghost/admin/package.json @@ -1,6 +1,6 @@ { "name": "ghost-admin", - "version": "5.82.4", + "version": "5.82.5", "description": "Ember.js admin client for Ghost", "author": "Ghost Foundation", "homepage": "http://ghost.org", diff --git a/ghost/core/package.json b/ghost/core/package.json index db5dd86e95..966617b1b8 100644 --- a/ghost/core/package.json +++ b/ghost/core/package.json @@ -1,6 +1,6 @@ { "name": "ghost", - "version": "5.82.4", + "version": "5.82.5", "description": "The professional publishing platform", "author": "Ghost Foundation", "homepage": "https://ghost.org",