#dineshkumar_docs
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.
- dineshkumar_docs, 3 days ago, 22 messages
- dineshkumar_docs, 4 days ago, 27 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/1253690067965444107
đ Have more to share? Add details, code, screenshots, videos, etc. below.
hi there!
how are you accepting payments? Checkout Session, Payment Element, something else?
subscription
ok, but how? with a Chekcout Session, Payment Link, the Subscription endpoint?
you should use webhook events to be notified when a user pays for a Subscripiton. you can learn more about this here: https://docs.stripe.com/billing/subscriptions/webhooks
no , i need to check promocode FirstTimeTransaction customer
so i need to find the customer already payment done or not.
I'm sorry I don't understand. can you explain your flow in more details and exactly what is the issue?
i created this promocde promo_1PU5dxBUmBAZBIgtHYK1B6Hn
this is restirction is, ""first_time_transaction"": true,
i need to apply this coupn in subscription, but before i need to check this is valid promocode for customer
i need to check this customer cus_P5wQFfOOb4eTmS done firsttime transaction done or not?
if you are using this parameter: https://docs.stripe.com/api/promotion_codes/create#create_promotion_code-restrictions-first_time_transaction
then Stripe will do the check for you.
i got this error "This promotion code cannot be redeemed because the associated customer has prior transactions."
var subscriptionCreateOptions = new SubscriptionCreateOptions
{
Customer = "cus_P5wQFfOOb4eTmS",
Items = new List<SubscriptionItemOptions>
{
new SubscriptionItemOptions
{
Price = "price_1OHkS0BUmBAZBIgtbJL84FOb",
},
},
PromotionCode = "promo_1PU5dxBUmBAZBIgtHYK1B6Hn"
};
subscriptionCreateOptions.AddExpand("latest_invoice.payment_intent");
var subscriptionService = new SubscriptionService();
try
{
Subscription subscription = subscriptionService.Create(subscriptionCreateOptions);
return Json(new { clientSecret = subscription.LatestInvoice.PaymentIntent.ClientSecret });
}
catch (StripeException e)
{
Console.WriteLine($"Failed to create subscription.{e}");
return BadRequest();
}
this is my code
before sunscrition i want check the promocode is valid one "promo_1PU5dxBUmBAZBIgtHYK1B6Hn"
so you want to check if it's valid before creating the Subscription?
well the simplest option would be to create the Subscription, and if you get an error you know it's not valid. another option would be to check if that customer has made any transactions in the past.
i need to check before create subscription
when i try to create the subscribtip with promocode subscription created right?
i need to check before create subscription
yes I explained how to do it above
here:
check if that customer has made any transactions in the past.
first step promocode is check if valid or not
and then step 2 apply promocode in sunscription
yes, makes sense
How we check , check if that customer has made any transactions in the past.
so you'll need to track/check on your end if the customer made a transaction is the part or not.
please guide link send me
you could use this to list all payment made by a specific customer: https://docs.stripe.com/api/payment_intents/list
for this how we check, doc please
understood , i will check
any other option? other than this https://docs.stripe.com/api/payment_intents/list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Why not just try to create the sub?
You'll get an error if it's not valid
Otherwise, no above is only option
if suppose valid promocode, the subscription created right? i need just check promocode valid or not before use it.
if suppose valid promocode, the subscription created right?
yeah but why is this an issue?
Wouldn't you want to create it if it's valid?
flow is:
step 1: promocode is check if valid or not
step 2 : use promocode in sunscription if valid only.
if promocode is invalid we restict on UI to create a subscription(disabled subsription button on UI)
Right, but a subscription won't be created if you pass an invalid coupon
The requirement is that it's two-separate steps?
If so, the solution my colleague provided is your only option
Yes two steps
step 1: promocode is check if valid or not
step 2 : use promocode in sunscription if valid only.