#nizar-naasani_best-practices
1 messages · Page 1 of 1 (latest)
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- nizar-naasani_best-practices, 14 hours ago, 19 messages
👋 Welcome to your new thread!
⏲️ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1247779032993497142
📝 Have more to share? Add details, code, screenshots, videos, etc. below.
You need to specify the promo code on the Subscription creation time, so it got applied to the first Invoice. If you only specify it in Update time then the first Invoice is finalized and can't be editted anymore
I'm using a custom ui for the payment that's why i need to create the subscription first
do you suggest me to create another subscription and ditch the older one when they use a promo code?
I'm not sure about your scenario, but why wouldn't a custom UI can't add the coupon? You can add the coupon on your backend API call
yes I'm able to add a coupon
but I'm creating the subscription when the customer goes to the checkout page and I give it these options
`var subscriptionOptions = new SubscriptionCreateOptions
{
Customer = customerId,
Items = new List<SubscriptionItemOptions>
{
new SubscriptionItemOptions
{
Price = priceId,
},
},
PaymentSettings = paymentSettings,
PaymentBehavior = "default_incomplete",
Metadata = new Dictionary<string, string> {
{ "email", viewModel.MemberEmail },
{ "phoneNumber", member.Mobile },
{ "memberId", member.Id.ToString() },
{ "basketItems", string.Join(",", member.Basket?.Select(x => x.Id)) },
{ "isMonthly", model.IsMonthly.ToString() },
{ "monthlyPriceId", monthlyPriceId }
},
};
subscriptionOptions.AddExpand("latest_invoice.payment_intent");`
that is beacuase I need the clientSecret to show the payment form
Okie, how about add discounts here https://docs.stripe.com/api/subscriptions/create#create_subscription-discounts
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
this is to update subscription or to create a new one?
sorry but what's the difference between this and applying a promo code?
This is specifying coupon on Creating Subscription
so this is not applying the promo code on it?
ok so how can I add it on creating the subscription? I can't seem to add it in SubscriptionCreateOptions
Yeah do you see the discounts.promotion_code parameter in that link?
Should be Discounts parameter
am I looking in the wrong place?
I think I'm using an old version of the sdk?
I;m using version 43.13.0 of Stripe.net
yup I updated the package and I can see it now
so this is not applying the promo code on the subscription? it's just to provide it as an option in case the customer use it?
No it should be applying the promo code. Please test it in Test mode
if it applys it then what's the difference between these two options?
?
Sorry which 2 options? There is only https://docs.stripe.com/api/subscriptions/create#create_subscription-discounts-promotion_code I believe
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
there is an option in the subscriptionCreateOptions called promotion code 🥲
Ah that's an old and deprecated one. Please ignore it and use the Discounts instead