#muhammad-talha-zubair_api

1 messages · Page 1 of 1 (latest)

zealous wraithBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always 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/1332056919317282898

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

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.

dusty pivot
#

Just to explain things in detail a bit.

#

I am implementing a system for my web application

#

In which user can pay the amount in one go. Or user can choose to pay in 6 months.

#

I checked the docs for the schedule subsctription. I think that can work in my case

#

But the problem i am facing that i cannot identify the flow for it.

#

That can handle both the scenario

#

Pay as one full amount or Pay in x months where total amount is splitted in each months.

#

And also i would need to save the information in my database as well.

#

To track the webhook details...

hollow umbra
#

Hello I’m trying to create my account

zealous wraithBOT
#

@hollow umbra looks like you're in the wrong place, this thread is for someone else's question.

Note that posting inappropriate messages in other people's threads is against the rules. No worries if this was just an honest mistake, but anyone who violates the rules multiple times will be removed from this server.

hollow umbra
#

Ok is there a way you can help me

opaque steppe
#

@dusty pivot I'll be with you in one moment!

dusty pivot
#

sure

opaque steppe
#

@hollow umbra No, please stop talking in this thread. If you continue I will have to remove you from the server.

#

@hollow umbra Please follow the instructions in the message above.

zealous wraithBOT
opaque steppe
dusty pivot
#

Actually @opaque steppe i already checked that

#

I am having this confusion

#

that for subscription schedule i will need to create products

#

but in my website i want to have both the functionality

#

to pay up front all amount or pay in installements

#

so in that case. for full payment i don't need to create product? and if user want to pay in the installements then i need to create the product?

#

or is there any way to create product and for same product i can pay the product in one go and also can pay the product in subscription schedules

opaque steppe
#

It depends on how you're handling the single, one-off payments. If you're just creating a Payment Intent directly for that, then no, a Product isn't required for that approach. But for the Susbcription Schedule approach you do need a Product, yes.

dusty pivot
#

actually i am still planning on how to do that. i was thinking is it possible to use the product in the payment intent as well?

opaque steppe
#

No, if you use Payment Intents directly you can't use a Product. Payment Intents are low-level payment objects and have no concept of things like Products, line items, etc.

dusty pivot
#

ok give me some time . let me watch the video

barren patrol
#

Hi there 👋 I'm jumping in as my teammate needs to step away soon. Please let me know if there are any questions that remain after you go through that video and I'll be happy to help.

dusty pivot
#

yes

#

Actually as you must have read the previous conversation as well

#

What should be the optimal solution stripe docs recommend in my case?

barren patrol
#

That depends on the experience you want to offer. There are multiple approaches to solve this within Stripe.

dusty pivot
#

Should i create products only when the subscription schedule is selected by users.

#

I actually was thinking what stripe recommends for it.

barren patrol
#

Whether or not you should create Product objects ahead of time or dynamically will depend on whether your product catalog and pricing is more fixed (the former would likely be better) or more dynamic (the latter would likely be better then). But you'll also need to take into account things like your reporting requirements.

dusty pivot
#

ok. Is there any way in stripe where for both cases i use product?

#

Weather user wants to pay full amount or subscription schedule. Can we use same product for both type of payments?

barren patrol
#

Sure, if you create Invoices for your one-time payments. (They'll have to use different Price objects, since Invoices would use one-time Prices and Subscriptions would use recurring Prices. But they can use the same Products).
https://docs.stripe.com/invoicing

dusty pivot
#

let me check wait

#

I think invoices are paid using checkout url only ?

dusty pivot
#

let me check

#

The link you shared does not accept payment automatically. It just send invoice emails.

#

I think i will go with the first solution that i elaborate before

#

I will pay payment intent if user wants to pay one full time

#

and for the installement i can create the product and pay using subscription schedule.

#

There comes another questions. When i create product i should set the recurring payment or something there?

#

Or subscription schedule will handle this automatically?

#

I just create product with name and price

#

Create a customer

#

Add payment method to customer

#

And then pay the product using customer id and his default payment method as subscription schedule.

barren patrol
#

Your question was about Invoices only being able to accept payments if a link is sent. The Stripe Elements tab in the step that I linked to shows how to use Elements to accept a payment for an Invoice on your own page.

dusty pivot
#

ok. I would prefer the first solution. Can you confirm the flow that i am thinking.

barren patrol
dusty pivot
#

Nice. So that means i would only need to create the product and set the price. And when passed to subscriptionSchedule api it will automatically handle that in background to consider it recurring ...

barren patrol
dusty pivot
#

ok let me check one thing

#

I think now i got that.

#

1- Create product

#

2- Create price for the product that will be recurring

#

3- Create customer

#

4- Create payment method for the customer

#

5- Pay the customer with the price using the subscriptionSchedule api

#

These are the steps in total for the implementation.

barren patrol
#

That's a very simplified version of the flow. Step 4 should either be handled by the first payment for the Subscription, or via a Setup Intent. You likely don't want to be creating Payment Methods directly. But our guides walk through that.

dusty pivot
#

Yeah. Need to send here the simplied version. But i think the right one?

barren patrol
#

Mhm

dusty pivot
#

And yes about the payment method i will add the card information using stripe elements

#

on frontend side

#

and attach the payment methods to customer

#

and so on

#

that i already done. no worries on that.

#

Thanks for the detail answered.

barren patrol
#

Any time! Glad we could help

dusty pivot
#

There is one question still remaning... if you can answer

barren patrol
#

Sure?

dusty pivot
#

1- One scenario is product is deleted? Can we do that? Does that delete the price as well? And does that affect the existing subscription?

#

2- Second scenario is product details with price is updated? I think in that case a new price is created. and we pay the customer using that new price id?

barren patrol
#

You can't delete a Product if it has any Prices associated with it.

Delete a product. Deleting a product is only possible if it has no prices associated with it. Additionally, deleting a product with type=good is only possible if it has no SKUs associated with it.
https://docs.stripe.com/api/products/delete

dusty pivot
#

oh that is good then.

#

And for updating?

barren patrol
dusty pivot
#

I see.

#

So until price is change. I need to use same price id for the customer subscriptoin.

#

Let suppose initially i create a product and price. For all the customer who subscribe to it. I will use the same price id that is created at first for all the subscriptions.

#

And when the price is change. We create the new price and make the previous price inactive and for new customer who make subscriptions we use the new price id?

#

And when we make the previous price inactive it does not affect the previous subscriptions?

barren patrol
#

Yup, exactly.

And we offer what we call Test Clocks, which let you test all of this behavior rapidly (without having to wait days/weeks/months for Subscriptions to progress through their lifecycle) so you can see exactly how this will all behave.
https://docs.stripe.com/billing/testing/test-clocks

dusty pivot
#

Cool. One last question. Can i get the latest price for a product or i need to save that in my database?

barren patrol
#

We have an endpoint for listing Price objects:
https://docs.stripe.com/api/prices/list

When using it you can use the filter parameters shown there, like active and product and type to narrow down the results to find the specific Price(s) you're looking for.

Storing the ID in your own database may have better performance though.

dusty pivot
#

ok thanks i will check these. thanks for the answers.