#ironbeard_api

1 messages · Page 1 of 1 (latest)

spare arrowBOT
#

👋 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/1398394453865140295

📝 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.

green sky
#

TLDR: You create a preview of an invoice for your customer while they’re considering a purchase. This allows you to show the total payment amount to your customer without the need to create an invoice.

night temple
#

Do preview invoices have similar status values like "draft", "open"? or are those only for "real" invoices?

green sky
#

Invoice previews will have a status of draft and it will not transition to any other state.

night temple
#

In my current checkout flow, I have multiple steps: 1) create account or log in (bc SaaS). When this form get sent to server, I create a Stripe Customer, 2) Contact Info form (name, phone number etc), when this info is submitted, I create the Subscription instance and pass the client secrets to the front end 3) payment form (StripeElement), which finalizes the payment and submits via Stripe.js.

During all of these steps, I'm displaying an invoice in the sidebar. Is using a preview invoice to get this information an acceptable approach?

Also, if I want to provide the customer with a "Confirm" page after they put in their payment info, when should I be creating the actual Subscription / real invoice objects?

green sky
#

Yes, creating the preview is a good use case in this instance. When you create the preview you can pass the customer and the subscription IDs and the preview will retrieve the upcoming invoice.

night temple
#

and I can determine if any payment is due for the real invoice by checking invoice.amount_due on the preview invoice?

green sky
#

You could listen for the related events such as the invoice_upcoming

night temple
#

Sorry, I meant: if someone is checking out and I'm getting ready to display the StripeElement, I can look at my preview invoice's amount_due to determine if I need to display the StripeElement or not, since if they have a promotion code they might not have anything due.

#

I think the missing piece for me now is, how do I collect payment details using StripeElement but don't confirm the purchase, so that I can display a "Review Order" page after creating the Subscription. Do I just not pass the client_secrets to the CardElement?