#syo

1 messages ยท Page 1 of 1 (latest)

drifting zodiacBOT
still wagon
#

๐Ÿ‘‹ how may I help?

#

*RESTful API is used as a prerequisite.
The code sets the line_items parameter, but the error message returns "Please set the line_items parameter." is returned.
The environment is Google Apps Script and the language is Javascript.
If you don't mind we can keep the discussion going on this thread

#

@graceful wind

#

what we want to solve plz
please share a request ID so I can take a look at the issue here

#

I would like to use the UrlFetchApp.fetch() method in Google Apps Script to call Stripe's RESTful API to create payment links for products registered with Stripe.
*Please do not login directly to Stripe to create the payment link.
I have set the line_items parameter,
The error Missing required param: line_items. is displayed and the payment link is not created.
Also, the value of paymentUrl returns null.
Could you please provide a solution to this problem?

#

@graceful wind please let's continue here

#

@graceful wind I would really need the request ID in order to help you

#

{ error: { code: 'parameter_missing', doc_url: 'https://stripe.com/docs/error-codes/parameter-missing', message: 'Missing required param: line_items.', param: 'line_items', request_log_url: 'https://dashboard.stripe.com/โ—‹โ—‹โ—‹', type: 'invalid_request_error' } }

Learn more about error codes and how to resolve them.

#

@graceful wind I'm moving all your messages here

#

function getPaymentUrl() { var stripeApiKey = 'sk_test_12345'; var stripeEndpoint = 'https://api.stripe.com/v1/payment_links'; var payload = { line_items: [ { price: 'price_1234567890', quantity: 1 }, ], custom_fields: [ { key: 'account_id', label: {type: 'custom', custom: 'Account ID'}, type: 'numeric', value: '12345' }, ] }; var options = { 'method': 'post', 'headers': { 'Authorization': 'Bearer ' + stripeApiKey, 'Content-Type': 'application/x-www-form-urlencoded' }, 'payload': JSON.stringify(payload

graceful wind
#

1sec

still wagon
#

@graceful wind, I still haven't had the chance to read through your messages

#

please hold a sec while I read through your messages, and respond properly

#

I also have other questions I need to attend to

#

please be patient

graceful wind
#

Thank you. Professional Staff.

still wagon
#

@graceful wind do you have the request ID that failed?

graceful wind
#

req_MEHK4HapHOCsmz

still wagon
#

thanks taking a look

#

the best way to send application/x-www-form-urlencoded is to send the javascript obkect as the payload instead of JSON.stringifying it

#

would you mind trying that?

#

the reason you're having this issue is because Stripe is not able to parse your payload body correctly

drifting zodiacBOT