#sive_code

1 messages ¡ Page 1 of 1 (latest)

quaint geodeBOT
#

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

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

uncut beacon
#

Additionally is this the correct way to go about adding a card where I want to generate stripe invoices in the future? I'm not certain whether the auto_advance or the charge_automatically flag is the one I should be using.

orchid surge
#

Yes setupintent is what you want for this

uncut beacon
orchid surge
#

You can use:

uncut beacon
# orchid surge You can use:

With this would I need to alter my client side submission handler

// Handle form submission and setup confirmation
    async function submitIntent(event) {
        event.preventDefault(); // Prevent the default form submit

        if (!stripe || !elements) {
            console.error('Stripe has not been initialized');
            return;
        }

        // Call confirmPayment method from Stripe
        const { error, setupIntent } = await stripe.confirmSetup({
            elements,
            confirmParams: {
                return_url: `${$page.url.origin}/dashboard` // Optional redirect URL after successful payment
            }
        });

        if (error) {
            // Display error to the customer (e.g., insufficient funds)
            const errorMessage = document.getElementById('error-message');
            errorMessage.textContent = error.message;
        } else if (setupIntent.status === 'succeeded') {
            // Payment succeeded, redirect to success page or show confirmation
            console.log('Payment succeeded!', setupIntent);
            //window.location.href = '/checkout/success'; // Redirect to success page
        }
    }
<form id="payment-form" class="space-y-4" on:submit={submitIntent}>
                <div id="payment-element">
                    <!-- Elements will create form elements here -->
                </div>
        <div id="address-element">
                    <!-- Elements will create form elements here -->
                </div>
                <Button type="submit" class="w-full">Verify Payment Method</Button>
                <div id="error-message" class="text-destructive">
                    <!-- Display error message to your customers here -->
                </div>
            </form>
uncut beacon
#

coolio

#

Do you have any knowledge of handling off session invoices with this information and the differences between auto_advance and charge_automatically?

orchid surge
uncut beacon
#

Do you know if an invoice will be generated an later charged that day if auto_advance is true and charge_automatically isfalse? To me reading the documentation it made it seem like the charge_automatically is mainly meant if you want to charge immediately but I'm okay if its done an hour or so later.

orchid surge
#

charge_automatically isn't something that's true or false

#

See above links I sent

#

it's one of 2 options for collection method

uncut beacon
#

ahh that makes more sense, I misunderstood

orchid surge
#

Recommend thoroughly reading those 2 docs I sent