#MarcusStripe

1 messages · Page 1 of 1 (latest)

scenic spruceBOT
olive citrus
#

Hi, it's simple that only with collection_method = send_invoicde you can call the Send Invoice API. If you set collection_method = charge_automatically, right after you finalize the Invoice we will try to charge the customer

#

I guess you want charge_automatically, so just create the Invoice and Finalize it

supple rover
#

and .. charge automatically.. will this also create an invoice and send it tot he customer?

#

and.. I need a payment intent.. where to take it instead.. at the moment I am taking it from the send invoice call

olive citrus
#

No you call Create Invoice API, then Finalize Invoice API, just those 2

#

After the Invoice is automatic attempted, you listen to webhook invoice.paid and take the PaymentIntent from that

supple rover
#

After the Invoice is automatic attempted... I dont understand.. how can the invoice be automatically be attempted, if hte customer has not yet typed in their credit card details / 3D secure for confimration.. which is what we need the payment intent for

#

How about directly:
Invoice.create(InvoiceCreateParams.builder()
.setCustomer(stripeCustomerId)
.setCollectionMethod(InvoiceCreateParams.CollectionMethod.CHARGE_AUTOMATICALLY)
.addExpand("payment_intent")
.build(), requestOptions);

#

and then adding the invoice item afterwards

#

InvoiceItem.create(InvoiceItemCreateParams.builder()
.setCustomer(stripeCustomerId)
.setPrice(stripePriceId)
.setInvoice(invoice.getId())
.build(), requestOptions);

olive citrus
#

Yes, so the Customer is expected to have a saved Payment Methods, in order for you to create a charge_automatically on them.

#

If the Customer doesn't, you would need to either:

  1. Collect their payment methods before hand, or
  2. Go ahead with send_invoice instead of charge_automatically and wait for the customer to see your email and key in their payment. But it can't have due_date = 0
supple rover
#

thye have a saved payment method

#

but AFAIK it still needs to be confirmed?

#

also, we currently use the invoice paid event to ACTIVATE the one time payment

#

so if there we COLLECT the payment intent.. something seems worng

#

wrong

olive citrus
#

Not sure what that mean. A saved PaymentMethod means it should already be confirmed

supple rover
#

the payment method IS confirmed

#

I am speaking of the one time payment itself

#

in the paid invoice, we check:

#

"manual".equals(stripeInvoice.getBillingReason());

#

and in this, on our end, we set the one time paid product to ACTIVE on our end

#

as a confirmation that the product now REALLY was finally paid

#

now if instead I would retrieve the payment intent from the invoice paid event.. I would send the payment intent to the UI / client to confirm payment.. and then.. would I get ANOHTER invoice paid event????

olive citrus
#

No of course I don't mean that. When you receive the invoice.paid event, you have the PaymentIntent that is already attempted. There is no need to send it to the UI again

#

You can think that when you Customer already have a saved PaymentMethods (on their invoice_settings.default_payment_method) and you create an charge_automatically Invoice then finalize it, Stripe automatically find the saved PaymentMethod and charge it, create a PaymentIntent, and produce an invoice.paid event for you

supple rover
#

so does the UI have to use / the payment intent to finanlize the payment.. or not?

#

How can the customer, in the UI, use the 3D secure method to confirm the payment?

brittle cape
#

Hi! I'm taking over this thread.

#

So you are creating invoices with charge_automatically, and you want to know how to handle failed payments due to 3DS?

supple rover
#

NO 😦