#omar-subscription

1 messages · Page 1 of 1 (latest)

thick sail
#

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

idle mesa
#

sorry i just want to explain my stock

thick sail
#

sure, I don't really need the JSON for this

#

but what's your question/what's blocking you?

idle mesa
#

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

thick sail
#

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?

idle mesa
#

i want to insert to my database some detailes for subscribe

#

how to do that

thick sail
#

what does that sentence mean "for subscribe"?

#

Do you mean when the subscription is created?

idle mesa
#

yes

thick sail
#

How are you starting a subscription? Are you using Checkout?

idle mesa
#

yes

thick sail
#

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?

idle mesa
#

no

thick sail
#

cool, what doesn't make sense exactly?

idle mesa
#

what variables i gan get after checkout done

#

session_id ?

thick sail
#

there's no "variable" you're misunderstanding this overall unfortunately

idle mesa
#

values

thick sail
#

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

idle mesa
#

ok thanks

upbeat stratus
#

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.

thick sail
#

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

upbeat stratus
#

Cool. Thank you :)

thick sail
#

sure!