Please help! Stripe Customer Portal Integration

I am trying to integrate the Stripe customer portal an I am having some issues, I do not understand what I am doing wrong but I get an undefined response from the createCustomerPortal function

Here is the integration guide:
https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#go-live

//import stripe from 'stripe';

const stripe = require('stripe')('private_key');

export async function createCustomerPortal(customerId, redirect) {

 let session =  await stripe.billingPortal.sessions.create ({
     customer: customerId,
     return_url: redirect,
    });
return session
 
}
export function button1_click(event) {
//var action = "/create_customer_portal_session";

  wixLocation.to('/create_customer_portal_session');

let redirect = "https://www.get4gwifi.com/"
let customerID = "cus_Hc4y57hXF1tOCq"

let result = createCustomerPortal(customerID,redirect)

 // $w("#text39").text = JSON.stringify(result);
     console.log(result.session)
      wixLocation.to(result);

 
}

1 Like

Hey,

You will probably find this post helpful.

Dara | Corvid Team