arlyon / async-stripe

Async (and blocking!) Rust bindings for the Stripe API
https://payments.rs
Apache License 2.0
454 stars 129 forks source link

Missing API Endpoint: /v1/checkout/sessions/:id/line_items #476

Open Aseeef opened 8 months ago

Aseeef commented 8 months ago

Is your feature request related to a problem? Please describe.

Currently, it doesn't seem we are able to retrieve a session's line items. CheckoutSession::retrieve() lets you retrieve the session, but the lineitems requires a separate call to: https://stripe.com/docs/api/checkout/sessions/line_items

Describe the solution you'd like

Maybe an optional parameter to CheckoutSession::retrieve() on whether or not to also retrieve the line items?

Ideally, also a method to an existing CheckoutSession object on populating missing line items.

Describe alternatives you've considered

I needed to get the quantity purchased by the user when CheckoutSessionCompleted is fired by the webhook. Since quantity lives in the line items, and line items aren't returned by default, I can't get the quantity from the CheckoutSession object.

Simple alternative is to store the sessions in my own application.

Additional context

No response

dgramop commented 8 months ago

Probably a similar underlying codegen bug as #475 . Will take a look

dgramop commented 8 months ago

Ok so not trivially solvable by doing the same thing that I did for #475. There's some additional handling being done for sessions stuff, and I don't completely understand the nuances there. Will revisit once that PR is merged