#Jeffrokt23
1 messages ยท Page 1 of 1 (latest)
Hi ๐ our Coupons and Promotion Codes are intended for discounting the amount of the payment being processed. If you don't want to discount the amount being paid, then I don't think using a Coupon would be a good fit.
Are you creating these Subscriptions directly through the API, or are they being created indirectly by a Checkout Session?
thanks for your response toby!
I think i agree regarding the coupon situation...Do you have recommendations for either scenario?
I'm actually not sure whether we're creating these through the API or via a checkout session.
If you're creating them directly, I would recommend leveraging metadata to store a key/value pair indicating you want to provide someone with a free gift, which can be consumed by other parts of your process and will be included in Events sent to your webhook endpoints:
https://stripe.com/docs/api/metadata
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ah ok thanks, that looks like it could help. How about for indrectly by checkout session?
That's a bit trickier, because you would either need a way for a Customer to provide the discount/coupon code in the Checkout Session but outside of our prebuilt promotion code field.
If you're able to detect before creating the Checkout Session that you want to provide a free item, then I would still recommend looking into using metadata. You could either put the metadata directly on the Checkout Session object:
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-metadata
or use subscription_data.metadata to put that information on the Subscription object that gets created:
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data-metadata
If you need to collect the code inside of the Checkout Session, then you could try using a custom field to collect that, but one of the downsides with that is you won't be able to provide your customers with instant feedback about whether the code they provided is valid.
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-custom_fields
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.