Wired up enableAutomaticTax feature flag to Stripe API
The automatic_tax option is required to enable tax collection for Stripe Checkout sessions. We've used getters here rather than an explicit function, might wanna change that in future.
This commit is contained in:
parent
6a093f4549
commit
6fcc7364e0
@ -1,5 +1,6 @@
|
||||
const logging = require('@tryghost/logging');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const labs = require('../../../shared/labs');
|
||||
|
||||
const messages = {
|
||||
remoteWebhooksInDevelopment: 'Cannot use remote webhooks in development. See https://ghost.org/docs/webhooks/#stripe-webhooks for developing with Stripe.'
|
||||
@ -64,6 +65,9 @@ module.exports = {
|
||||
...keys,
|
||||
...urls,
|
||||
enablePromoCodes: config.get('enableStripePromoCodes'),
|
||||
get enableAutomaticTax() {
|
||||
return labs.isSet('stripeAutomaticTax');
|
||||
},
|
||||
webhookSecret: webhookSecret,
|
||||
webhookHandlerUrl: webhookHandlerUrl.href
|
||||
};
|
||||
|
@ -20,6 +20,7 @@ const STRIPE_API_VERSION = '2020-08-27';
|
||||
* @prop {string} secretKey
|
||||
* @prop {string} publicKey
|
||||
* @prop {boolean} enablePromoCodes
|
||||
* @prop {boolean} enableAutomaticTax
|
||||
* @prop {string} checkoutSessionSuccessUrl
|
||||
* @prop {string} checkoutSessionCancelUrl
|
||||
* @prop {string} checkoutSetupSessionSuccessUrl
|
||||
@ -395,6 +396,9 @@ module.exports = class StripeAPI {
|
||||
cancel_url: options.cancelUrl || this._config.checkoutSessionCancelUrl,
|
||||
// @ts-ignore - we need to update to latest stripe library to correctly use newer features
|
||||
allow_promotion_codes: discounts ? undefined : this._config.enablePromoCodes,
|
||||
automatic_tax: {
|
||||
enabled: this._config.enableAutomaticTax
|
||||
},
|
||||
metadata,
|
||||
discounts,
|
||||
/*
|
||||
|
@ -73,6 +73,9 @@ module.exports = class StripeService {
|
||||
secretKey: config.secretKey,
|
||||
publicKey: config.publicKey,
|
||||
enablePromoCodes: config.enablePromoCodes,
|
||||
get enableAutomaticTax() {
|
||||
return config.enableAutomaticTax;
|
||||
},
|
||||
checkoutSessionSuccessUrl: config.checkoutSessionSuccessUrl,
|
||||
checkoutSessionCancelUrl: config.checkoutSessionCancelUrl,
|
||||
checkoutSetupSessionSuccessUrl: config.checkoutSetupSessionSuccessUrl,
|
||||
|
Loading…
Reference in New Issue
Block a user