#riptired

1 messages · Page 1 of 1 (latest)

foggy cradleBOT
limpid jacinth
#

hello! can you share the request id?

hearty brook
#

Here is some context on how I am initializing the session:

const session = await stripe.checkout.sessions.create({
payment_method_types: ['card'],
submit_type: 'pay',
customer: customer.id,
shipping_options: [
{
shipping_rate_data: {
display_name: 'Shipping',
fixed_amount: {
currency: CURRENCY,
amount: formatAmountForStripe(metadata.shippingCost as number),
},
},
},
],
automatic_tax: {
enabled: true,
},
line_items: [
{
price_data: {
currency: CURRENCY,
product_data: {
name: metadata.productTitle!,
description: metadata.productDescription!,
// images: [metadata.imageUrl!],
metadata: {
...metadata,
},
},
unit_amount: 2000,
},
quantity: QUANTITY,
},
],
mode: 'payment',
shipping_address_collection: {
allowed_countries: [ALLOWED_COUNTRY],
},
success_url: ${WEBSITE_URL}success,
cancel_url: ${WEBSITE_URL}cancel,
});

#

Those are the logs

limpid jacinth
hearty brook
#

If I add it, it doesn't like that string

#

it says that the type does not exist on price_data

#

@limpid jacinth

limpid jacinth
#

onesec, my bad, i was looking at the wrong thing

hearty brook
#

ok

#

Any updates?

#

@limpid jacinth

limpid jacinth
hearty brook
#

its impossible for me to debug because I can't see any attributes that I need to set that have just "type"

#

I can wait

hearty brook
#

Interesting, let me try that

#

thanks

#

I am getting this issue now
{
"statusCode": 500,
"message": "Automatic tax calculation uses fields saved on the Customer. To collect a shipping address with automatic_tax enabled, set customer_update[shipping] to 'auto' to save the shipping address back to the Customer."
}

limpid jacinth
#

it seems fairly self explanatory, do you have any specific question about it?

hearty brook
#

Can the shipping address be prefilled in the checkout session if I pass it in from a created customer?

limpid jacinth
#

i can't remember off the top of my head, but you should be able to test it out

hearty brook
#

Hmm okay

#

where should customer_update[shipping] be set though?

#

I already create a customer object before starting the session

hearty brook
#

Okay

#

Is it possible for me to use a custom subdomain if I am using stripe purely in nextjs?

limpid jacinth
#

i'm not entirely sure how using a custom subdomain relates to Stripe in this case

hearty brook
#

well you can use custom domains for stripe checkout

limpid jacinth
#

yes, you can use custom domains for Stripe Checkout, but it doesn't have anything to do with nextjs as far as I can tell

hearty brook
#

We are using next js API endpoints to create a checkout session

#

We are unable to redirect to the checkout session on the custom subdomain

#

But we have successfully posted a checkout session

limpid jacinth
#

We are unable to redirect to the checkout session on the custom subdomain - what's the error?

hearty brook
#

res.redirect(303, session.url as string);

we have this line on the next.js API endpoint, but the page does not redirect for us to the custom subdomain

limpid jacinth
#

have you tried returning the url to your frontend and redirecting from the frontend instead?

hearty brook
#

The docs said it has to be a server side redirect? But we will try this thanks