Hosted billing portal

Our hosted customer billing portal comes fully out of the box—no code or development work required. Your customers can manage their subscriptions, update payment methods, cancel or add plans, and configure billing details all in one place.

You can configure your billing portal settings here.


To create a hosted billing portal, navigate to a customer’s details page (from the customer's tab) and select the "create billing portal" button from the available dropdown options on the top left block:

That will generate a link that will take you to the hosted billing portal for that specific customer. Here they can update their subscriptions and payment methods.

Install and import our client

For this recipe, we will use the Python SDK, which you can install using pip install getopenpay or poetry add getopenpay

from getopenpay.client import ApiKeys, OpenPayClient

OP_PUBLISHABLE_TOKEN = 'TODO_YOUR_PUBLISHABLE_TOKEN'
OP_SECRET_TOKEN = 'TODO_YOUR_SECRET_TOKEN'

api_keys = ApiKeys(publishable_key=OP_PUBLISHABLE_TOKEN, secret_key=OP_SECRET_TOKEN)

# sandbox/staging environment
sandbox_host = 'https://connto.openpaystaging.com'

# production environment
production_host = 'https://connto.getopenpay.com'

Generate billing portal

The billing portal will stay active for 24 hours

response = client.billing_portal.create_portal_session(
  CreatePortalSessionRequest(
    customer_id='TODO_TARGET_CUSTOMER_ID',
    return_url='https://your_return_url_after_checkout',
  )
)
print(f'Your customers can manage their profiles here: {response.url})