#dragonlord_api

1 messages ยท Page 1 of 1 (latest)

abstract thistleBOT
#

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

livid egret
#
        $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

stray sparrowBOT
cinder quail
#

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

livid egret
#

perfect should have done a little bit more digging

#

but this helped me perfect

#

thanks so much