Stripe: Fatal error: Class ‘Stripe\BillingPortal\Session’ not found

I am trying to create a redirection to the Stripe customer portal.


try {

    $body = json_decode($HTTP_RAW_POST_DATA);
    $checkout_session = \Stripe\Checkout\Session::retrieve($session_id);
    $stripe_customer_id = $checkout_session->customer;
    $return_url = "http://someurl";
    $session = \Stripe\BillingPortal\Session::create([
      'customer' => $stripe_customer_id,
      'return_url' => $return_url,
  } catch (Exception $e) {
    echo json_encode([
      'error' => [
        'message' => "error $session_id",

I get this error: Fatal error: Class 'Stripe\BillingPortal\Session' not found

[EDIT] I am following this guide. Everything works except accessing the billing portal.

Additional information. There are similar issues in other questions that suggest that this is a problem in the way the Stripe library was installed but I would like to know if someone knows what exactly is going on.

Read more here:

Content Attribution

This content was originally published by juanjo75es at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: