#djk3600
1 messages ยท Page 1 of 1 (latest)
Yes one second please!
Status
400 ERR
ID
req_gIne04Fl1dStXF
Time
19/12/2022, 19:04:25
IP address
86.140.252.53
API Version
2022-08-01
Latest
Source
Stripe/v1 NodeBindings/11.2.0
Idempotency
Key โ c533f617-0ce9-41cf-8e30-d4a80db987d1
Thanks, looking
Yep so receipt_email isn't an object. It should just be a top level string: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-receipt_email
Is your code using a variable there?
It should just be receipt_email: "x@y.com"
const { items, shipping, description, userEmail } = req.body;
// Create a PaymentIntent with the order amount and currency
const paymentIntent = await stripe.paymentIntents.create({
amount: calculateOrderAmount(items),
currency: "gbp",
automatic_payment_methods: {
enabled: true,
},
description,
shipping: {
address: {
line1: shipping.line1,
line2: shipping.line2,
city: shipping.city,
country: shipping.country,
postal_code: shipping.postal_code,
},
name: shipping.name,
phone: shipping.phone,
},
receipt_email: userEmail,
})
I'd also recommend redacting your actual email address since this is a public server
Yep so looks like your userEmail is an object.
Try userEmail.customerEmail there instead
I am pulling it via the request body
Okay trying now
one second ๐
nice one mate!
it worked, the automatic email didn't send though, would you be able to help me solve this issue please?
We don't send those emails in test mode
So as not to spam folks
You can send it manually via the Dashboard to see what it would look like
You view the PaymentIntent and click "send receipt" on the Dashboard
ahhhh!
Let me check now
ahhh it worked!!
So if it wasn't in test mode would it send automatically?
Yep
Yep, no Customer will be created here if you are just taking a card payment unless you use a Customer object using: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-customer
Okay brilliant - mate you are really good I appreciate it so much ๐
last little question if I may...
Sure
I have been running into this error
parameter_invalid_integer - amount
Invalid integer: 14092.000000000002
What have you guys found to be the best way to solve it??
Sorry for delay!
I missed your response!
My bad
You can't set decimals for amount @sacred ruin
You use the smallest currency unit as shown here: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-amount
Is your code calculating that amount?
You likely have some small rounding issue in your code that you will want to look into