Skip to content

[feat]: Generate Session Portal URL #57

@henrylee746

Description

@henrylee746

Description

Rather than building our own "Cancel Subscription" or "Update Card" pages, Stripe also comes with a prebuilt Customer Portal we can use (again, good for PCI compliance)

  1. If haven't already, enable the Stripe Customer Portal in dashboard settings and configure which functionalities you want the customer to have (done, used default settings)

  2. Create a simple link or Server Action that redirects the user to the customer portal link. They can log in to the portal with their email address and a one-time passcode.

Make sure your customers have an email (https://docs.stripe.com/api/customers/object#customer_object-email) set. They should already have one if you tested a successful payment with it. If multiple customers have the same email address, Stripe selects the most recently created customer that has both that email and an active subscription.

For security purposes:

Customers can’t update their email address through this link.
If a customer doesn’t receive a one-time passcode after clicking the login link, make sure their email address matches the email address of an existing customer. To check, go to the Stripe dashboard and search for the email (you can ask @henrylee746 to check or get an invite to the dashboard if you want to check frequently often yourself)

Documentation ref: https://docs.stripe.com/customer-management/activate-no-code-customer-portal

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions