#Loterak
1 messages · Page 1 of 1 (latest)
Wait so your users cannot remove the Promo code once applied? Do you have an example Checkout Session ID?
Is this it??
cs_test_a1ghJqMv2vaAKRNwzHipKuyhs4bAZXzgkda2StmZLoqpkFM8uaVuoKZphX#fidkdWxOYHwnPyd1blpxYHZxWjA0TGRKPHRBTU9RVG5LVTFHYUFjTHV3TDF9NEpCTmJxMG1nZld%2FS3RGYTJfNkxoN3BxQXxtVzFTYWZ%2FTHdjTGBXf2l8bG12SjxSTmBLfUc1bXNhRzFVMWxENTVTU2I0V3FfQycpJ2hsYXYnP34nYnBsYSc%2FJ0tEJyknaHBsYSc%2FJzIwNTM9NTMyKDQ9NjEoMT1nNChnNDxnKGNkY2NkYDRnZGQ1ZjQzPDxjNCcpJ3ZsYSc%2FJ2E3ZDNjYTMyKGA1MDcoMT02Mig8YDEyKDA8MTNjN2YzZmNnNjdkZzZkPSd4KSdnYHFkdic%2FXlgpJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ3dgY2B3d2B3SndsYmxrJz8nbXFxdXY%2FKiozNzc3KDQzMigwMig0MjAoNDY3K3ZkK2tid2puK2xqJ3gl
This Checkout Session was created with a hard-coded discount only. In order to enable the Promo Code UI you need to also pass allow_promotion_code: true
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-allow_promotion_codes
ohh, I see. Let me give that a try.
Okay, so either I allow the user to enter the code or I force the code on the checkout.
There is no way for me to pre-apply the coupon when creating the checkout but make it removable?? I would like users to replace it with their own if they have one.
Have you tested out doing both? You can create checkout sessions with your Test API keys and use some test promo codes
Stripe::Checkout::Session.create(
customer_email: current_user.email,
payment_method_types: ['card'],
mode: 'subscription',
line_items: [{ price: stripe_price_id, quantity: 1 }],
discounts: [{ promotion_code: 'promo_1LrSIHDHJTQkNP4BnrYx5aSs' }],
allow_promotion_codes: true,
success_url: success_url,
cancel_url: redirect_url
)
when doing this the logs throw an error
Ah, okay
And you would like to provide a default promo code but allow your users to remove/change them?
exactly
many marketing efforts give out other promo codes, but our users sometimes can't enter them because of the default code
Okay. Well on the down side I don't see that as possible currently. However, I will raise it as a feature request internally. It does feel like something that should be possible.
that would be awesome if eventually we could get it. We will work around it for now, but it would save us a lot of time
just allow_promo_codes with the option to pre-fill the code, just so the user does't have to input it manually
Alright I've filed the feedback and will discuss this internally.
thanks!
Happy to do it 🙂
I can't promise any timeline but requests like that are how we make our products better
of course, I understand. would not expect a timeline either. But it would be a really nice feature