diff --git a/ghost/members-api/index.js b/ghost/members-api/index.js index 1b6f099156..9ec6c9416e 100644 --- a/ghost/members-api/index.js +++ b/ghost/members-api/index.js @@ -218,7 +218,8 @@ module.exports = function MembersApi({ const sessionInfo = await stripe.createCheckoutSession(member, plan, { successUrl: req.body.successUrl, cancelUrl: req.body.cancelUrl, - customerEmail: req.body.customerEmail + customerEmail: req.body.customerEmail, + metadata: req.body.metadata }); res.writeHead(200, { diff --git a/ghost/members-api/lib/stripe/index.js b/ghost/members-api/lib/stripe/index.js index 293913a2a9..c1857af5bf 100644 --- a/ghost/members-api/lib/stripe/index.js +++ b/ghost/members-api/lib/stripe/index.js @@ -115,12 +115,14 @@ module.exports = class StripePaymentProcessor { } const plan = this._plans.find(plan => plan.nickname === planName); const customerEmail = (!customer && options.customerEmail) ? options.customerEmail : undefined; + const metadata = options.metadata || undefined; const session = await this._stripe.checkout.sessions.create({ payment_method_types: ['card'], success_url: options.successUrl || this._checkoutSuccessUrl, cancel_url: options.cancelUrl || this._checkoutCancelUrl, customer: customer ? customer.id : undefined, customer_email: customerEmail, + metadata, subscription_data: { items: [{ plan: plan.id