#omar-subscription
1 messages · Page 1 of 1 (latest)
Hey @idle mesa what do you need help with?
Also can you edit your message to remove all that JSON? It's really hard to read the message
@idle mesa here instead of the main channel
sorry i just want to explain my stock
sure, I don't really need the JSON for this
but what's your question/what's blocking you?
i want retrive subscribe session to get variables like this
$id = $event->data->object->id;
$amount = $event->data->object->amount_captured;
$currency = $event->data->object->currency;
$cus_email = $event->data->object->receipt_email;
$name = $event->data->object->billing_details->name;
so i can isert it to my database
after subscribe sucsess
sure so what's the issue?
like right now the code you have is unrelated to the JSON of the subscription
also you seem to talk about webhook details but never mentioned it either
Can I ask you to try and clarify in more words what you are really trying to do right now?
what does that sentence mean "for subscribe"?
Do you mean when the subscription is created?
yes
How are you starting a subscription? Are you using Checkout?
yes
Okay so if you use Checkout you want to read https://stripe.com/docs/payments/checkout/fulfill-orders
you would listen to checkout.session.completed which confirms when Checkout started the subscription. At that point you should have access to all the information you are after
does that make sense?
no
cool, what doesn't make sense exactly?
there's no "variable" you're misunderstanding this overall unfortunately
values
You get an event on your webhook endpoint. That event is associated with a specific object in our API. For example if you listen to checkout.session.completed then you get a Checkout Session resource entirely. So it has all the information you see on https://stripe.com/docs/api/checkout/sessions/object for example
It will have information about the customer in customer_details for example and it will have the corresponding Subscription id sub_123 in subscription as a property
And then you can use https://stripe.com/docs/api/subscriptions/retrieve to retrieve the entire Subscription object with more details, and its associated invoice, etc.
ok thanks
Hey, sorry for barging in. But I had the same doubt, so I wanted to ask if we can use invoice.paid instead of checkout.session.completed to save data in db, and provide user access to my product?
Let me know if I'm interfering. I'll send a separate message, if so.
you an use invoice.paid sure, it's needed for future payments too. But I would still use checkout.session.completed for the first payment to store all the information I need
Cool. Thank you :)
sure!