mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
Fixed issues with checkout when not using coupon
no-issue We were incorrectly checking for the existence of a coupon id - instead we simplify the signature, and make sure the check is correct.
This commit is contained in:
parent
93a37f98be
commit
e78b2f80bc
@ -196,7 +196,7 @@ module.exports = class RouterController {
|
||||
if (!member) {
|
||||
const customer = null;
|
||||
const session = await this._stripeAPIService.createCheckoutSession(priceId, customer, {
|
||||
coupon: {id: couponId},
|
||||
coupon: couponId,
|
||||
successUrl: req.body.successUrl || this._config.checkoutSuccessUrl,
|
||||
cancelUrl: req.body.cancelUrl || this._config.checkoutCancelUrl,
|
||||
customerEmail: req.body.customerEmail,
|
||||
@ -241,7 +241,7 @@ module.exports = class RouterController {
|
||||
|
||||
try {
|
||||
const session = await this._stripeAPIService.createCheckoutSession(priceId, stripeCustomer, {
|
||||
coupon: {id: couponId},
|
||||
coupon: couponId,
|
||||
successUrl: req.body.successUrl || this._config.checkoutSuccessUrl,
|
||||
cancelUrl: req.body.cancelUrl || this._config.checkoutCancelUrl,
|
||||
metadata: metadata
|
||||
|
@ -351,6 +351,7 @@ module.exports = class StripeService {
|
||||
* @param {string} options.successUrl
|
||||
* @param {string} options.cancelUrl
|
||||
* @param {string} options.customerEmail
|
||||
* @param {string} [options.coupon]
|
||||
*
|
||||
* @returns {Promise<import('stripe').Stripe.Checkout.Session>}
|
||||
*/
|
||||
@ -360,7 +361,7 @@ module.exports = class StripeService {
|
||||
await this._rateLimitBucket.throttle();
|
||||
let discounts;
|
||||
if (options.coupon) {
|
||||
discounts = [{coupon: options.coupon.id}];
|
||||
discounts = [{coupon: options.coupon}];
|
||||
}
|
||||
const session = await this._stripe.checkout.sessions.create({
|
||||
payment_method_types: ['card'],
|
||||
|
Loading…
Reference in New Issue
Block a user