#ReneDenmark-checkout-promo-code
1 messages · Page 1 of 1 (latest)
Hey there! Can you share the ID of the Checkout Session?
ReneDenmark-checkout-promo-code
Thanks let me check
Here is the js code: const options = {
clientSecret: clientsecret,
// Fully customizable with appearance API.
appearance: {/.../},
};
// Set up Stripe.js and Elements to use in checkout form, passing the client secret obtained in step 5
elements = stripe.elements(options);
// Create and mount the Payment Element
const paymentElement = elements.create('payment', {
fields: {
"allow_promotion_codes": true,
billingDetails: {
//name: 'never',
//email: 'never',
//address: 'never'
}
}
});
paymentElement.mount('#payment-element');
Ah, so you're not using Checkout?
ohh sorry.
allow_promotion_codes isn't a valid parameter with Elements
Aha. Not in any form?
Not in custom payment flows, no. You'd need to add that yourself to your own UI and then pass the value when creating the Subscription: https://stripe.com/docs/api/subscriptions/create#create_subscription-promotion_code
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
The associated discount would then be reflected on the resulting Payment Intent
Ok. To bad. Thanks for the effort.
You could use Checkout instead, which will make this way easier
Yes, but we like the in page payment instead of the redirects.