#omar alhity-subscription-data
1 messages ยท Page 1 of 1 (latest)
after customer subscribe
i want to insert in database amount & session_id & customer_id
how to get it from sucsess page
$_GET['session_id']
$_GET['amount_m']
$_GET['customer_id'] ?
Gotcha, thank you for that clarification. You can use this approach to append the ID of the checkout session to the success_url , which your success page can then consume.
https://stripe.com/docs/payments/checkout/custom-success-page
However, that approach relies on your customer successfully landing on and fully loading your success page in order for the information to be logged in your database, which we don't recommend as it puts your process at risk of being interrupted if your customer is unable to do so. For example, if the customer is on their phone on a train, and after hitting "subscribe" they go into a tunnel and lose service, they won't be able to load your success page and their order won't be logged in your database.
Instead we recommend leveraging webhooks for this part of your process:
https://stripe.com/docs/webhooks
and what i want to customer portal to display billing
customer_id ?
$customer = \Stripe\Customer::retrieve($session->customer);
$customer->id;
can i get in this way ?
create-poratl-session.php?customer_id
The Checkout Session object has the contains the Customer ID in it, so you could retrieve the session and pull the Customer ID from it:
https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-customer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.