#smiley-dev-promotion-code

1 messages ยท Page 1 of 1 (latest)

frigid crater
#

then generate a promotion code from the coupon

stoic sky
#

Thank you @frigid crater , but Where can I input promotion code?

#

so that customers input the promotion code and set coupon if the code is correct.

frigid crater
#

you are using Stripe Checkout right?

stoic sky
#

I have just tested with payment link for the promotion code.

#

yeah.

frigid crater
#

yeah, that's the code user needs to enter

stoic sky
#

But I don't need it for the subscription. I use default payment method for now.

frigid crater
#

if it is valid, the coupon will be applied underneath

stoic sky
#

Yes, it works for the checkout page, but I am not sure how can add it to the subscription with default payment method.

#

I have tried to set promotion code to the subscription when create a subscription, but the coupon hasn't been set to the subscription, otherwise other coupon worked well.

#

I set a promotion code, but paid full payment.

frigid crater
#

how did you apply the promotion code?

#

do you have any code sample?

stoic sky
#

just on the dashboard for now.

#

after confirm that, will do through the api

frigid crater
#

I see

#

you are having a trial

#

the promotion code will be applied on the very first invoice

#

which is a 0 dollar invoice because you have a 30 days trial

#

you will need to apply the promotion on the trial end.

stoic sky
#

I see, how can I set promotion code through the UI. I am not sure how can I create subscription with UI.

#

If I input the promotion code and then click the apply, which endpoint should I hit then?

#

Coupon will be applied when the subscription is created. right? and how can I validate promotion code before creating subscription with UI like above input.

frigid crater
#

depends on your integration path, you can

  1. if you are creating subscription through API : directly pass promotion code here https://stripe.com/docs/api/subscriptions/create?lang=python#create_subscription-promotion_code
  2. if you are integrating with Stripe checkout session, you can https://stripe.com/docs/api/checkout/sessions/create?lang=python#create_checkout_session-discounts-promotion_code Or you can allow your customer to enter the codehttps://stripe.com/docs/api/checkout/sessions/create?lang=python#create_checkout_session-allow_promotion_codes, Stripe Checkout will validate the promotion code automatically
stoic sky
#

I understand with subscription page by validating stripe, but what I want to know is that which endpoint can I hit to validate promo code, i.e. I am curious what will be happened after click the apply in here.

frigid crater
#

I see

#

and check if there are any active promotion code exists

#

The returned promotion code will contain a lot of information that you can use for further checking as well as the promotion code could be set to apply for a Single customer or a set of products etc.

stoic sky
#

Ok. I see. thank you, and I am curious about the limit param so far, I am a big fan about the stripe, ๐Ÿ˜‰

#

If there are more than 100 items in promo, account, customer and so on, how can I get all items?

#

i.e. I have no filter param for promo code here, so I can only get 100 items as maximum? as others...

#

๐Ÿ˜ฆ

#

I don't think coupon doesn't affect to the subscription.

#

If I use another coupon that has no promotion code, it works.

frigid crater
stoic sky
frigid crater
#

the default is that stripe returns 10 per page with max 100 per page

stoic sky
#

understood pagination .:)

#

How about this solution:
we can use subscription item for the first subscription payment if there is a validated promotion code???

#

how do you think?

#

a bit weired.

frigid crater
#

Yeah, let me check, that is indeed weird.

#

can you share your subscription created with the coupon?

#

sub_xxxx

#

I can check

stoic sky
#

Yup.

#

sub_1JZt8nKdPfuTg5NInWPk3KKS

frigid crater
#

yeah, smallbusiness is a coupon only applies to product prod_Je9yEJQ4BvYUe1

#

when you create this coupon, you specify what product it can be applied to

#

and your subscription is for product prod_JeCQweDF6mniNj

#

so that's the reason why it was not applied

#

so it is correct

stoic sky
#

Oh, wonderful, ๐Ÿ™ thank you so much!

#

This is why I love stripe, thank you for your help today. ๐Ÿ˜„