#mukhiddin25_docs

1 messages · Page 1 of 1 (latest)

runic otterBOT
#

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

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

mellow spade
#

Hello

I'm confused as here you said you want to send invoice

there are places where it is not suitable for us, so we want to check the time of the end of the tariff and send it to you to charge money. please through which api can i do this

and here you said you want to charge the payment method for an invoice

First of we charge first amount from customer using Payment Intent API and for secodary time I have already attepmt by using create invoice with flag immediately charge from card, I send customer ID and amount, unfortunately amount is not accept

granite crescent
#

I don't even know is it possible charge money using invoice that is why I have tried, but It did not work may be I misundersatand

mellow spade
#

You can. You need to create an invoice item first. You can't create an invoice with just the amount

granite crescent
#

Greate!
First payment I charge by using Payment Intent API and I have configured webhook event, it is working greate

mellow spade
#

Yes but make sure to set setup_future_usage parameter as that's required to save a payment method

granite crescent
#

Before first charge I am creating customer and then I create Intent by passing customer and setup_future_usage = off_session

mellow spade
#

Great

granite crescent
#

May I get payment method ID from success webhook event ? and with this payment method ID I will send create invoice by passing default_payment_method ?

#

Is there a connection between creating this item and creating an invoice?

mellow spade
#

Is there a connection between creating this item and creating an invoice?
what do you mean by "this" item?

granite crescent
#

Is there a connection between create invoiceitem and create invoice? between those APIS

mellow spade
#

Yes, see: https://docs.stripe.com/api/invoiceitems

Invoice Items represent the component lines of an invoice. An invoice item is added to an invoice by creating or updating it with an invoice field, at which point it will be included as an invoice line item within invoice.lines.

Invoice Items can be created before you are ready to actually send the invoice. This can be particularly useful when combined with a subscription. Sometimes you want to add a charge or credit to a customer, but actually charge or credit the customer’s card only at the end of a regular billing cycle. This is useful for combining several charges (to minimize per-transaction fees), or for having Stripe tabulate your usage-based billing totals.

granite crescent
#

As result

  • create invoice
  • create invoice item (send invoice ID when creating invoice item)

Am I correct understood ?

#

Which step money will charge from customer card ?

mellow spade
#

The order doesn't matter as the API supports both.

#

After the invoice is finalized, the payment method will be charged

granite crescent
#

which API should I call forn finalize invoice ?

#

Do any confirmation need by customer for finalize invoice?

mellow spade
#

if you set collection_method: charge_automatically then you won't need to call that API.
We'll automatically finalize the invoice.

#

https://docs.stripe.com/api/invoices

If your invoice is configured to be billed through automatic charges, Stripe automatically finalizes your invoice and attempts payment. Note that finalizing the invoice, when automatic, does not happen immediately as the invoice is created. Stripe waits until one hour after the last webhook was successfully sent (or the last webhook timed out after failing). If you (and the platforms you may have connected to) have no webhooks configured, Stripe waits one hour after creation to finalize the invoice.

If your invoice is configured to be billed by sending an email, then based on your email settings, Stripe will email the invoice to your customer and await payment. These emails can contain a link to a hosted page to pay the invoice.

granite crescent
#

After finalize API success responding does it meas money charged of customer card ? can I complete in our logic as payment success passed ?

or this complation logic should be after in webhook success event ?

mellow spade
#

I'd wait for invoice.paid event

granite crescent
#

does It settings in one place for intent and invoice webhook event ?

mellow spade
#

Not sure what you mean by that, can you elaborate?

granite crescent
#

I have configured webhook endpoint in stripe cabinet, event is coming when payment intent happened. Should I configure for invoice event another one ?

#

is one endoint enough both method ?

mellow spade
#

Yes, the same endpoint can listen to various events

granite crescent
#

Ok I will try If any other question will appear May I ask here ?

mellow spade
#

The thread may close after some time but you can always open a new one if needed from #help channel

granite crescent
#

Greate

#

thank you very much for your time