#OneShot-Invoces

1 messages · Page 1 of 1 (latest)

honest onyx
#

Hi there, how can I help?

stuck pelican
#

Hi Jack, I'm currently using the Stripe API with the subscriptions on a custom payment flow. I realized that i don't need to offer subscriptions but when looking on the docs here https://stripe.com/docs/payments/quickstart i'm missing the part where i can link payments to customers created on stripe and also get the price from products also created on stripe.

I was told a few days ago that i could use the invoice API for this purpose, but what is not clear to me, is how to get the payment from the user, i know that i need to have the customer and the products created beforehand but, creating the invoice just give me the options to send the invoice directly to the customer email or collect it automatically, which would require the user inputing their payment data before that.

When doing subscriptions you create the subscription and then collect the user payment information with a payment intent client secret. Is there something similar that would work with invoices in this case?

honest onyx
#

You mention subscirption on custom payment flow, can you elaborate more on this?

stuck pelican
#

But i would like to know if i can get the payment from the customer on my custom checkout after creating the invoice

honest onyx
#

OK this custom flow basically allows you to collect the payment method and set it as the default payment method for the subscription. When the inovice is due for payment, Stripe will automatically attempt to charge the customer based on the default payment method if the collection method is set to charge_automatically

stuck pelican
#

Is there a way for this to work?

#

The products won't be subscriptions but regular products for one time purchases

honest onyx
#

So basically you just want to create an ad-hoc invoice and charge the customer? am I right?

stuck pelican
#

Yeah, the invoice basically would be for linking it to the customer, for that i just want to create it without sending it to the customer and then charge for it

honest onyx
#

I see, you can use the inovice API to create a invoicce, finalize it and pay it.

stuck pelican
#

I'm not sure about the finalize and pay it steps, is there any example or docs on this?

honest onyx
stuck pelican
#

Setting auto_advance to false would help with this?

honest onyx
#

If you want the invoice to be paid automatically, you should set it to true

stuck pelican
#

But in which step do i collect the payment information?

honest onyx
stuck pelican
#

So basically, this would work like this:

  1. Create the customer and product
  2. Create a SetupIntent where i would collect the payment info from the customer
  3. Create the invoice and charge it automatically with the payment info collected previously

Right?

honest onyx
#

Yes, that's correct!

stuck pelican
#

Thanks Jack!