Skip to content

feat: added checkout session #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Niki2k1
Copy link
Contributor

@Niki2k1 Niki2k1 commented Aug 4, 2025

What kind of change does this PR introduce?

This PR adds sync for the checkout sessions (and line items)

Additional context

I created two new migrations (one for the checkout sessions and one for the line items.

I am not yet using this in production, so I am a little bit cautious. My tests worked fine though.

@jackkru69
Copy link

We also need this feature, can someone watch this PR?

@revoks
Copy link

revoks commented Aug 6, 2025

This feature is something we urgently need on our side as well.
Would love to see this merged - thanks so much for your work!

Copy link
Contributor

@kevcodez kevcodez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

Can you please

  • Add the webhooks to the README as supported
  • Clarify whether line items are present in webhooks
  • Add an appropriate webhook test

)

// Upsert line items into separate table
const lineItemsPromises = checkoutSessions
Copy link
Contributor

@kevcodez kevcodez Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a single upsert and not one upsert per line item ideally

Are line items sent via the webhook by default? Otherwise the checkout session line items would never be there for a regular webhook

@Niki2k1
Copy link
Contributor Author

Niki2k1 commented Aug 7, 2025

Thank you for the Review.

I inspected a checkout session event and indeed there are no line items, so either I would've to fetch them via the api or ignore them and only sync checkout sessions. What do you think?

For my use-case it would be really nice to have the line items directly when syncing

@kevcodez
Copy link
Contributor

kevcodez commented Aug 7, 2025

@Niki2k1 yeah makes sense, i think a check session without persisting the line items themselves would not add too much value.

I think it would be best to call stripe.checkout.sessions.listLineItems (and set a high limit of 100) if no line items is provided - we also have an expansion feature that can be used (see expandEntity).

So

  • If line items is already present, use expandEntity
  • If line items are not present, pull from API using listLineItems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants