#pepski
1 messages · Page 1 of 1 (latest)
evt_1MOJbFFDkTksHoXpGIQWl9Lj
this invoice was created via checkout.session but I am not able to pair it.
Could you please share an Checkout Session ID as well cs_xxx? Are you creating a Subscription or one-time payment?
cs_test_a1pLz5Uu1jninSgKwILVAR4jCQj25K219aFIP366DJpuNt9WltwW97auy7
subscription
I create a session, attach the session to my subscription object in the api, but I don't know how to to get proper stripe subscription id, ... I can do it with event checkout.session.completed, where are both id checkoutSessionId with subscriptionId. But this event is triggered after invoices and payments, and i don't know how to pair them.
The invoice object has a subscription property, given it was created by a Subscription: https://stripe.com/docs/api/invoices/object#invoice_object-subscription
yes I know that, but i don't have the subscription ID
Why would you need to pair it with a Checkout Session?
I have an subscription object in our api, i create a checkout session for it for creating the subscription also at your side, now I have to pair my object with your object.
If I understand correctly, you want to pass your own subscription ID to Stripe? You can use metadata for that: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-metadata
1] I have my subscription object
2] I create checkout session for creating subscription on your side
3] checkout session is filled by customer
4] I firstly receive the invoice.created event - there is identification of stripe.subscriptionId, but I don't have this ID in my database, so I cant pair it
5] than comes event about payments, again related to stripe.subscription but I still don't have this id in my database
6] then comes checkout.session.completed - there I am finally able to say hey, my subscription object = stripe.subscription from the checkout.session.completed
but its too late, because all other events already fails
sure no problem
You can rely on the Customer object for this. When new Invoices are created they will be attached to the same customer.
but customer can have multiple subscriptions rigt?
In theory, yes. But it depends on how your integration works.
cool thanks