#andrei4002_api

1 messages ยท Page 1 of 1 (latest)

real sirenBOT
#

๐Ÿ‘‹ 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/1302968550306086933

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

heady stone
#

๐Ÿ‘‹ happy to help

#

the only two options here is Invoice or Checkout

mint pasture
#

thanks! a few more related questions, first, for the checkout option - will it automatically add all the available payment processors like apple pay, amazon, google etc if they are available?

#

for the invoice option, i guess it's the only other one that supports coupons, but is it related in any way to the other payment processors? what would be my options for the frontend part?

heady stone
#

thanks! a few more related questions, first, for the checkout option - will it automatically add all the available payment processors like apple pay, amazon, google etc if they are available?
yes

#

for the invoice option, i guess it's the only other one that supports coupons, but is it related in any way to the other payment processors? what would be my options for the frontend part?
you would use the underlying PaymentIntent's client_secret with the PaymentElement

mint pasture
#

okay, the payment intent approach seems a bit more involved, not sure if i got it correctly - for using the PaymentElement and having the coupon functionality, i should have a self-hosted form where i show the user an option to submit the coupon code (this is something not part of PaymentElement), and on the backend i should create some Stripe::InvoiceItem(s) (ruby) and a Stripe::Invoice, which will have an underlying payment intent setup?

heady stone
#

yes exactly

#

by expanding on the payment_intent you will get the client_secret that you need to return to your frontend to use it

#

to confirm the payment

mint pasture
#

sounds good, thanks! got one last question more related with the invoices, from what i saw you can't setup an invoice with specific invoice items, it kind of picks up the items that have been created and not paid for yet. I'm thinking of weird cases like when you create some items and don't finalize them for some reason, and maybe later you create other items, and want to finalize/pay those instead with an invoice. would the invoice pick up the old items as well? did i get this right? and would that mean from a dev perspective that i should make sure i manage those invoice items (ie remove old ones)?

heady stone
#

sounds good, thanks! got one last question more related with the invoices, from what i saw you can't setup an invoice with specific invoice items, it kind of picks up the items that have been created and not paid for yet
it depends on which API version you're using

mint pasture
#

oh, and when you create the item, you set the invoice param on it

#

okay, that's perfect, thank you so much!

heady stone
#

sure thing let me know if you need any more help

mint pasture
#

i guess if im gonna be using the "collect the coupon myself" approach, i'm also responsible for calculating the estimated amount on the invoice to show to the user after he enters it? or is it something like i can apply the coupon to the invoice and then pull the final amount from the invoice if the coupon is valid for items in the invoice ?

heady stone
#

i guess if im gonna be using the "collect the coupon myself" approach, i'm also responsible for calculating the estimated amount on the invoice to show to the user after he enters it?
no you can pass the coupon ID as a discount to the invoice

mint pasture
#

and then ask the invoice for the discounted / final amounts ?

heady stone
#

when you pass the discount the invoice calculates the total for you

mint pasture
#

okay, sounds good, thanks!