#dragonlord_api
1 messages ยท Page 1 of 1 (latest)
๐ 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/1304195179636457556
๐ 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.
- dragonlord_api, 2 minutes ago, 16 messages
$invoiceItem = $stripe->invoices->create([
'description' => 'Credits',
'customer' => $customer_id, // Replace with actual customer ID
'collection_method' => 'charge_automatically',
]);
// Step 2: Create the invoice and set to auto-charge
$invoice = $stripe->invoiceItems->create([
'customer' => $customer_id, // Same customer ID
'invoice' => $invoiceItem->id,
'unit_amount' => 1000, // $10.00
'currency' => 'usd',
]);
$stripe->invoices->finalizeInvoice($invoiceItem->id, ['auto_advance' => true]);
I am using sandboxes
I want to show the user the link to pay for the invoice just in case their payment on file does not work
Hello again ๐ I believe that email behavior is suppressed in testmode/sandboxes.
https://docs.stripe.com/test-mode#test-email
but you can configure emails to be sent when the Invoice is finalized:
https://docs.stripe.com/invoicing/send-email#customer-emails
If you want a link to a hosted UI where customers can complete paying for the Invoice, I'd suggest seeing if the hosted_invoice_url matches what you're looking for:
https://docs.stripe.com/api/invoices/object#invoice_object-hosted_invoice_url