Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Stripe get product id for one-time payments

I would like to get the product id for one-time payments, but I am unable find ANY webhook event that would give me the id of the product purchased.

I know that for subscriptions, invoice.paid event provides the product id, but one-time payments do not produce invoice.

I have read some suggestions such as appending product id to metadata of checkout session and listening for checkout.session.completed, but I am not sure whether that is a reliable source for the confirmation of the payment.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

If you use Checkout for one-time payment, then yes checkout.session.completed is the event you want. However you will need to Retrieve and expand the Checkout Session using its Id. You can expand its line_items.data.price.product.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading