Stripe: listCheckoutSessionLineItems bug

Expected behaviour

When using the Stripe List Checkout Session Line Items server action it’s throwing an error:

{
  "status": "500",
  "message": "Stripe: Argument \"session\" must be a string, but got: [object Object] (on API request to `GET /checkout/sessions/{session}/line_items`)",
  "stack": "Error: Stripe: Argument \"session\" must be a string, but got: [object Object] (on API request to `GET /checkout/sessions/{session}/line_items`)\n    at /opt/node_app/node_modules/stripe/lib/makeRequest.js:29:13\n    at Array.reduce (<anonymous>)\n    at getRequestOpts (/opt/node_app/node_modules/stripe/lib/makeRequest.js:26:29)\n    at /opt/node_app/node_modules/stripe/lib/makeRequest.js:83:14\n    at new Promise (<anonymous>)\n    at makeRequest (/opt/node_app/node_modules/stripe/lib/makeRequest.js:80:10)\n    at Constructor.listLineItems (/opt/node_app/node_modules/stripe/lib/StripeMethod.js:38:7)\n    at App.exports.listCheckoutSessionLineItems (/opt/node_app/lib/modules/stripe.js:857:37)\n    at App._exec (/opt/node_app/lib/core/app.js:481:57)\n    at App._exec (/opt/node_app/lib/core/app.js:452:28)"
}

I’m expecting to get the line items object from stripe: https://stripe.com/docs/api/checkout/sessions/line_items

Reproduce

  1. Create webhook server action: checkout.session.completed image

  2. Create List Checkout Session Line Items and put $_POST.data.object.id under the session param

https://stripe.com/docs/api/checkout/sessions/line_items

  1. Test webhook using the Stripe CLI

Extra notes:

I’m guessing the issue lies in what is returned in \lib\modules\stripe.js line 856

Because that same binding: $_POST.data.object.id
does work with Retrieve Checkout Session https://stripe.com/docs/api/checkout/sessions/retrieve

Seems to be fixed by changing:
return stripe.checkout.sessions.listLineItems(options,__extra);

to

return stripe.checkout.sessions.listLineItems(session, __extra);

Seems like the sessions variable wasn’t being returned.

Can this be a permanent fix so my stripe integration doesn’t break the next Stripe update :slight_smile: ?
Thanks!

@George
Just updated to 4.7 and saw that the stripe.js file is changed.
Issue is still there, would love a permanent fix from you so I don’t need to keep watching this file :slight_smile:
Thanks!

To summarise, this is what I’d like:
In lib/modules/stripe.js line 857 change options to session

Bump.

Hope this small fix can be done soon, it is difficult to prevent the stripe.js from changing. The wappler version keeps creeping back in, leading to 30 min of bug hunting before realising this line changed again.

This has been fixed in Wappler 4.9.1

This topic was automatically closed after 2 days. New replies are no longer allowed.