#saintlike_code

1 messages ยท Page 1 of 1 (latest)

rapid epochBOT
#

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

๐Ÿ“ 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.

rich narwhal
#

Hey, so I am just copying off the docs and im getting the runtime error I described in the form

export default async function Page() {

    // create a customer first, then calculate how much to charge, then create a payment intent
    // to calculate how much to charge, pull the price from the database

    const customer = await stripe.customers.create()

    const { client_secret: clientSecret } = await stripe.paymentIntents.create({
        customer: customer.id,
        setup_future_usage: "off_session",
        confirm: true,
        amount: 4999,
        currency: 'usd',
        automatic_payment_methods: {
            enabled: true,
        },
    })

    return (
        <div>
            <h1>Checkout</h1>
            <CheckoutForm clientSecret={clientSecret} />
        </div>
    )
}```
This is where i am creating customer and payment intent

```js
const handleSubmit = async (e) => {
        e.preventDefault()
  
        if (!stripe || !elements) {
            // Stripe.js hasn't yet loaded.
            // Make sure to disable form submission until Stripe.js has loaded.
            return
        }
  
        setIsLoading(true)

        // Before we confirm the payment, we need to set the customer's name and email
  
        const { error } = await stripe.confirmPayment({
            elements,
            confirmParams: {
                // Make sure to change this to your payment completion page
                receipt_email: email,
                return_url: "http://localhost:3000/success",
            },
        })``` then this is the handle submit action
scarlet forge
#

Hello, can you link to the doc? I can make sure we correct it. To fix that you will need to specify a return_url in your initial payment intent create call. Because that call has confirm: true and it may result in a redirect being required, it needs to know where to send the customer after the redirect process if necessary

rapid epochBOT
rich narwhal
#

My desired goal is that the customer gets assigned to the newly created payment intent, then after payment is successful i call a webhook (also looks same as in docs), I modify customer name and email to match the input fields ( so in dashboard the customer has a name + email), then send additional request in the webhook to notify the business that a purchase was made

#

If there is a better convention to modify customer details please let me know ๐Ÿ˜ƒ

rich narwhal
sacred sand
#

Pompey has to step away so I'll be taking over this thread. Give me a moment to catch up.

#

I see you're passing customer.id for the customer in the PaymentIntent creation request. Is a PaymentMethod attached to the customer?