#suraj kumar
1 messages · Page 1 of 1 (latest)
Hi
You can't apply coupon to a SetupIntent. A coupon is used for a payment (amount >0)
we are having a subscription and we want to enable coupon functionality in it, how can we. do that ?
You can pass the coupon the subscription, check this guide:
https://stripe.com/docs/billing/subscriptions/coupons?dashboard-or-api=api
For example, when you create a Subscription you pass the coupon:
const subscription = await stripe.subscriptions.create({
customer: 'cus_4fdAW5ftNQow1a',
items: [{price: 'price_CBb6IXqvTLXp3f'}],
coupon: 'free-period',
});
okay.
i have some warnings, could you please help me
We've detected that you are using payment_method_types to configure payment methods. To manage payment methods from this page, replace payment_method_types with automatic_payment_methods. If you prefer to use payment_method_types, refer to the manual settings page.
You should be using automatic_payment_methods instead of using payment_method_types when creating Payment/Setup Intents.
i'm using automatic_payment_methods only while creating setup intents but using payment_method_types while creating subscriptions.
is there anything wrong in this
Nothing wrong there, but this is just a recommendation. Even for subscription, just remove the payment_settings.payment_method_types when creating a Subscription if you want to follow the recommended integration:
https://stripe.com/docs/api/subscriptions/create#create_subscription-payment_settings-payment_method_types
we have multiple subscription i we want to attach a payment method with a subscription so used it.
In that case, I'm not sure how you are using payment_method_types ? you just need to pass the PaymentMethod id to the Subscription:
https://stripe.com/docs/api/subscriptions/create#create_subscription-default_payment_method
Hi! I'm taking over from my colleague. Please, let me know if you have any other questions.