#bastien_93455

1 messages ยท Page 1 of 1 (latest)

glass joltBOT
empty gyro
#

request POST BODY : {
"mode": "payment",
"line_items": "[{"price":"price_1NzJnkKyMBSMZ5jqxwSrpF6p","quantity":1},{"price":"price_1NzJnlKyMBSMZ5jqCg3JtHw6","quantity":2}]",
"cancel_url": "https://example.com/cancel",
"success_url": "https://example.com/success",
"payment_method_types": [
"card"
]
}

#

It looks like your setup is wrapping and escape quoting the line items array, so we get one long string instead of a valid json array

glass joltBOT
glass field
odd kiln
#

๐Ÿ‘‹ catching up, give me a sec

#

Ah are you using netsuite connector or trying to integrate API natively?

glass field
#

Natively

odd kiln
#

I think the issue is somewhere in this line
'&line_items=' + JSON.stringify(lineItems) +

#

Your JSON.stringify call is creating a string from the line items

#

we expect an array of hashes

glass field
#

I've tried without ... and I have another error

odd kiln
glass field
#

req_dpWf9CUuH5triU

odd kiln
#

yeah seems like your code is somehow passing [object Object],[object Object] as line items

#

sorry these are netsuite basics, we can't help with those sort of questions.
Would recommend looking for right netsuite docs on this

glass field
#

yes this is when I remove the JSON.stringify

#

going back with my first post, my call seems correct, this is my line_items : [{"price":"price_1NzL7ZKyMBSMZ5jq72YcFdAp","quantity":1},{"price":"price_1NzL7ZKyMBSMZ5jqC5UqCuwU","quantity":2}] and still the response is invalid array

#

req_oSD8EmD1RgrPQd

odd kiln
glass field
#

Yes I understand, when I format my array with stringify it is a string and I have an error and when I don't use the stringify it is another error ๐Ÿ˜ฆ anyway, thanks for your help