#dev123-portal
1 messages · Page 1 of 1 (latest)
Thank you for trying helping me
I found the problem : I was on an bad file....🤒 So It was old test code. Now I have this message :
You can’t create a portal session in test mode until you save your customer portal settings in test mode at https://dashboard.stripe.com/test/settings/billing/portal.
I 'am on https://dashboard.stripe.com/test/settings/billing/portal and it is configured
ok, now I have a blank page, let's me see deeper
because is hosting in my localhost : billing.stripe.com n'autorise pas la connexion.
The reason is that I don't use endpoint but this :
echo '<form action="create-portal-session.php" name="aboClientF" method="POST">';
echo '<input type="hidden" id="session-id" name="session_id" value="'.$_SESSION['session_id'].'" >';
// echo '<button id="checkout-and-portal-button" type="submit">Manage your billing information</button>';
echo '<span class="boutonsWebmaster" onClick="document.aboClientF.submit();">Gérez votre abonnement</span>';
echo '</form>';
Do you know how can I do to redirect in a blank stripe page instead includig in mine ? I want to say how to redirect action="create-portal-session.php" to stripe ? hope you unserstand what I mean
Do you have any idea ? The create-portal-session.php is embedded in my code, so the browser says: billing.stripe.com doesn't all connexion. How can I force to redirect to stripe ? Thank for any idea
Hey @vapid sorrel! Taking over from Jack – just catching up
Hello ynnoj, thank trying help me !
I'am trying to create a client portal for subscirption
sorry but where can I check if the portal was created ?
I mean from dashboard
Are you able to share a request ID from your Dashboard? https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
There's no record of the Billing Portal sessions in the Dashboard (other than the logs). They're short lived so aren't really persisted anywhere
Taking a look
ok, thank. As i said, my understand is that the return url give an unauthorized connexion to the response of the submit ( from "return_url": "http://192.168.0.16/demo.wbAdm/admin/frmAdmin.php?affAdmin=17&aff2=0&codeRetourPaiement=1",). It is like a html problem. But I don't know why the form isn't redirected to stripe ?
here the code of the button :
echo '<form action="create-portal-session.php" name="aboClientF" method="POST">';
// echo '<input type="hidden" id="session-id" name="session_id" value="'.$_SESSION['session_id'].'" >';
echo '<button id="checkout-and-portal-button" type="submit">Manage your billing information</button>';
// echo '<span class="boutonsWebmaster" onClick="document.aboClientF.submit();">Gérez votre abonnement</span>';
echo '</form>';
and the code of : create-portal-session.php :
try {
$checkout_session = \Stripe\Checkout\Session::retrieve($_POST['session_id']);
$return_url = $YOUR_DOMAIN;
// Authenticate your user.
$session = \Stripe\BillingPortal\Session::create([
'customer' => $checkout_session->customer,
'return_url' => $return_url,
]);
header("HTTP/1.1 303 See Other");
header("Location: " . $session->url);
}
catch (Error $e) {
http_response_code(500);
echo json_encode(['error' => $e->getMessage()]);
}
Are you redirecting users to the url parameter? This is the hosted Stripe page: https://stripe.com/docs/api/customer_portal/session#portal_session_object-url
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Is there some kind of error in your application?
I guess something with frame and target, or ip...Let's me have a test on my domain and not on localhost/dev. Few minutes please, I need a ☕ ...
before testing
Can you share the error? Is there a specific reason for using the 303 status code?
if you mean header("HTTP/1.1 303 See Other"); in create-portal-session.php it is a copied code from examples. Should I remove it ?
Now you've shared that screenshot that suggests seems kind of configuration issue blocking billing.stripe.com on your localhost
Yes I have got it working !
I replace the button like this :
onClick="window.open('create-portal-session.php', '_blank');
So now I have understand I have to create a webhhok, isn't ?
So now I have understand I have to create a webhook, isn't ?
I will try create a webhook, and if necessary open a new thread,
Hope it will not necessary 😉 ,
for moment I Have to go out. I will try webhook this afternoon,
Thank you very much for your help,
even It was on my code, you help me to understand
Nice! What do you need the webhook for?
I understand it is an event that notify the client about each payment ? isn't ?
So I just want the client been notified to pay each month
Do you confirm ?
Or it is not necessary yet ?
Sorry for this question, but I am beginner with stripe and I am french, sometimes is not obvious reading all docs and having a perfect comprehension
So does I need a webhook for notifications are send automatically ?
You want them to be notified to pay, or that they have paid?
Can you please share the Subscription ID?
yes, it is a product ID
prod_Kdqi8JaOGdSsjr
Have you not created a subscription with the product/price?
Yeah so with a correctly configured subscription you don't need to prompt your customers to pay
The recurring payments are just automatically collected as per the billing interval
How do you mean?
ok ,let my previous message,
I have to implement something like this ?
$stripe->subscriptions->create([
'customer' => 'cus_KeEL4hnqzUyuo3',
'items' => [
['price' => 'price_1JyZ1YGPrFXOX5m0WAFgkVOs'],
],
]);
Yes, exactly!
This is a good intro to Billing/Subscriptions: https://stripe.com/docs/billing/subscriptions/overview
And the integration guide: https://stripe.com/docs/billing/subscriptions/build-subscription
ok, fantastic, ....
I will check all of this this afternoon as I have to go...
It is more clear for me now, I want to thank you again, and all the team, you do a good job !
I will try by myself, and ask you only if I have some big problems....Hop it would not be necessary😉
Thank you again, I must leave👋
Good luck! We'll be here if you need help