#anishsubedi1_83944

1 messages ยท Page 1 of 1 (latest)

grand ravineBOT
crystal finch
#

This is the customer portal:

grand ravineBOT
white sphinx
#

looking into it

#

Are you sure to change credit card info in subscription (not payout) we need to use customer portal?

ebon stratus
#

Yes that is the Customer Portal, if you create and link to a Customer Portal session that should be the same thing that the page links to

white sphinx
#

a the Above pic is from Employer account; where we can go into each customer, and get that share payment update link and send them.

We are doing subscriptions directly through API (Create customer first the directly then create subscription).
Can this "payment update link" also be provided to user directly api? Like getting direct "payment update link" which opens stripe customer platform.

ebon stratus
white sphinx
#

looking into it.

white sphinx
#

works. Thank you.

#

just a sec

grand ravineBOT
white sphinx
#

can we hide/delete this renew or cancel subscription button from here?

#

Only allowing them to update card. We are allowing cancel sub/ renew through our portal directly.

grand sky
white sphinx
#

But we didn't use "Create a portal configuration" api.

grand sky
#

How did you create the Customer Portal?

#

This server is focused on developers coding integrations with Stripe APIs so our advice tends to default to suggesting API solutions

white sphinx
#

We did not create Customer Portal.

Whenever user wants to subscribe to our Platform. We do following:

  1. Create a unique customer through stripe API for that customer // Or, if stripe_Customer_id already exist in our database use that
  2. Create a subscription for that customer

That's all.

Now, to allow users to update credit card on their subscription. We are trying to use this:

const getCusotmerPortal = async () => {
const stripe = require('stripe')(
'"',
);
const session = await stripe.billingPortal.sessions.create({
customer: detail.userPaymentProfile.payVendorCustomerId,
return_url: 'http://localhost:8080/#/user/profile',
});
window.open(session.url);
return;
};

grand sky
#

Okay that stripe.BillingPortal is the Customer Portal in our docs (sometimes our naming isn't clear)

#

So you can create a Configuration object that customizes what is available to your customers and then use the ID of that configuration when you create the Billing Portal

white sphinx
#

We used simple this:
"// create a stripe customer
const customer = await stripe.customers.create({
name: name,
email: email,
});

grand sky
#

No that's not what I"m talking about

#

It's the other part of your code

#
    const session = await stripe.billingPortal.sessions.create({
      customer: detail.userPaymentProfile.payVendorCustomerId,
      return_url: 'http://localhost:8080/#/user/profile',
    });

this part creates a Customer (Biling) Portal

white sphinx
#

We have not used this.

grand sky
#

Then where are you seeing the Cancel Plan button? What is creating that interface?

white sphinx
#

their I will repeat my question just to be clear:

Whenever user wants to subscribe to our Platform. We do following:
a. Create a unique customer through stripe API for that customer // Or, if stripe_Customer_id already exist in our database use that
const customer = await stripe.customers.create({
name: name,
email: email,
});
b. Create a subscription for that customer
const subscription = await stripe.subscriptions.create({
customer: customerId,
items: [{ price: priceId }],
})
That's all.

Now, we want to allow users to update credit card details on their exisitng subscriptions.

grand sky
#

Then you would use the Billing (Customer) Portal

#

That is the interface Stripe provides for those features.

white sphinx
#

Yea, that means use this right?
const getCusotmerPortal = async () => {
const stripe = require('stripe')(
'"',
);
const session = await stripe.billingPortal.sessions.create({
customer: detail.userPaymentProfile.payVendorCustomerId,
return_url: 'http://localhost:8080/#/user/profile',
});
window.open(session.url);
return;
};

grand sky
#

Yes. Except that, in order to implement the functionality you want, you will need to create a Configuration object and pass that ID when creating the BillingPortal session

white sphinx
#

Oh okay. And, this configuration will be applied to all the customers?


const configuration = await stripe.billingPortal.configurations.create({
  features: {
    customer_update: {
      allowed_updates: ['email', 'tax_id'],
      enabled: true,
    },
    invoice_history: {enabled: true},
  },
  business_profile: {
    privacy_policy_url: 'https://example.com/privacy',
    terms_of_service_url: 'https://example.com/terms',
  },
});```
grand sky
#

The configuration species the features you want to be available for a specific portal session. If you want all your customers to have the same features then you can use the same configuration ID for all your billing portal sessions.

#

But if you want to offer some customers different features you can create separate configuration objects and use those IDs

white sphinx
#

basically, create configuration and pass to customer object. And, finally portal will open based on that configuration. ?

grand sky
#

No, you pass the configuration when you create each Billing Portal session, not each Customer

white sphinx
#

Ok. Will read that doc and get back again.

#

Thank you so much for help.

grand sky
#

You are very welcome, it is why we are here ๐Ÿ™‚