#zach_api

1 messages ¡ Page 1 of 1 (latest)

valid sapphireBOT
#

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

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

keen quiver
#

What are those errors?

stiff sentinel
#

StripeInvalidRequestError: Invalid array at StripeError.generate (file:///home/zach/projects/domain.com.au/node_modules/.pnpm/stripe@16.1.0/node_modules/stripe/esm/Error.js:7:20)

#

StripeInvalidRequestError: Received unknown parameter: shipping_address_collection[0]
at StripeError.generate (file:///home/zach/projects/domain.com.au/node_modules/.pnpm/stripe@16.1.0/node_modules/stripe/esm/Error.js:7:20)

#

commented out each issue to remove the error and they just keep popping up, it's like nothing I pass to it works

upbeat pagoda
#

Hi, let me help you with this.

#

What do you mean by "commented out each issue"?

stiff sentinel
#

but it seems that each one just gives a new error

#

I'm trying to buy various line items from price IDs but only within Australia, with $10 shipping, AUD currency etc.

upbeat pagoda
#

What are other errors you're getting?

stiff sentinel
#

ah I'm just a noob at understanding documentation, apologies

#

I'll go fix those and get back to you

upbeat pagoda
#

No worries. Sure.

stiff sentinel
#
    const session = await stripe.checkout.sessions.create({
        line_items: lineItems,
        mode: 'payment',
        currency: "aud",
        success_url: '/success',
        cancel_url: '/cancel',
        shipping_address_collection: {
            allowed_countries: ['AU']
        },
        total_details: { 
            amount_shipping: 1000
         }
    });

Now I'm getting StripeInvalidRequestError: Received unknown parameter: total_details

upbeat pagoda
#

What is total_details?

stiff sentinel
upbeat pagoda
#

This is not a parameter you can use in the Create Session method.

stiff sentinel
#

Alright I just tried that and got this error:

#

StripeInvalidRequestError: Not a valid URL

#
    const session = await stripe.checkout.sessions.create({
        line_items: lineItems,
        mode: 'payment',
        currency: "aud",
        success_url: '/success',
        cancel_url: '/cancel',
        shipping_address_collection: {
            allowed_countries: ['AU']
        },
        shipping_options: [ 
            { shipping_rate: "shr_1PtQCq2KWVGERRoayuGXnXEP" }
         ]
    });
#

oh it's because I changed my success and cancel URLs to be relative

stiff sentinel
#

Didn't have to do this before and had it working

upbeat pagoda
upbeat pagoda
#

The amount is too large, you need to create a Price with a smaller amount.

stiff sentinel
#

ah

#

it was a test amount lol

#

working!

#

finally

#

I was strugllign with this for ages ty

upbeat pagoda
#

Happy to help.