Create a portal configuration 

Creates a configuration that describes the functionality and behavior of a PortalSession

Parameters

  • featuresobjectRequired

    Information about the features available in the portal.

  • business_profileobject

    The business information shown to customers in the portal.

  • default_return_urlstring

    The default URL to redirect customers to when they click on the portal’s link to return to your website. This can be overriden when creating the session.

  • login_pageobject

    The hosted login page for this configuration. Learn more about the portal login page in our integration docs.

  • metadataobject

    Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

Returns

Returns a portal configuration object.

POST /v1/billing_portal/configurations
curl https://api.stripe.com/v1/billing_portal/configurations \
-u "sk_test_BQokikJ...2HlWgH4olfQ2sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \
-d "features[customer_update][allowed_updates][]"=email \
-d "features[customer_update][allowed_updates][]"=tax_id \
-d "features[customer_update][enabled]"=true \
-d "features[invoice_history][enabled]"=true
Response
{
"id": "bpc_1MrnZsLkdIwHu7ixNiQL1xPM",
"object": "billing_portal.configuration",
"active": true,
"application": null,
"business_profile": {
"headline": null,
"privacy_policy_url": null,
"terms_of_service_url": null
},
"created": 1680290736,
"default_return_url": null,
"features": {
"customer_update": {
"allowed_updates": [
"email",
"tax_id"
],
"enabled": true
},
"invoice_history": {
"enabled": true
},
"payment_method_update": {
"enabled": false
},
"subscription_cancel": {
"cancellation_reason": {
"enabled": false,
"options": [
"too_expensive",
"missing_features",
"switched_service",
"unused",
"other"
]
},
"enabled": false,
"mode": "at_period_end",
"proration_behavior": "none"
},
"subscription_update": {
"default_allowed_updates": [],
"enabled": false,
"proration_behavior": "none"
}
},
"is_default": false,
"livemode": false,
"login_page": {
"enabled": false,
"url": null
},
"metadata": {},
"updated": 1680290736
}

Update a portal configuration 

Updates a configuration that describes the functionality of the customer portal.

Parameters

  • activeboolean

    Whether the configuration is active and can be used to create portal sessions.

  • business_profileobject

    The business information shown to customers in the portal.

  • default_return_urlstring

    The default URL to redirect customers to when they click on the portal’s link to return to your website. This can be overriden when creating the session.

  • featuresobject

    Information about the features available in the portal.

  • login_pageobject

    The hosted login page for this configuration. Learn more about the portal login page in our integration docs.

  • metadataobject

    Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

Returns

Returns a portal configuration object.

POST /v1/billing_portal/configurations/:id
curl https://api.stripe.com/v1/billing_portal/configurations/bpc_1MrnZsLkdIwHu7ixNiQL1xPM \
-u "sk_test_BQokikJ...2HlWgH4olfQ2sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \
--data-urlencode "business_profile[privacy_policy_url]"="https://example.com/new_privacy_url" \
--data-urlencode "business_profile[terms_of_service_url]"="https://example.com/new_terms_of_service_url"
Response
{
"id": "bpc_1MrnZsLkdIwHu7ixNiQL1xPM",
"object": "billing_portal.configuration",
"active": true,
"application": null,
"business_profile": {
"headline": null,
"privacy_policy_url": "https://example.com/new_privacy_url",
"terms_of_service_url": "https://example.com/new_terms_of_service_url"
},
"created": 1680290736,
"default_return_url": null,
"features": {
"customer_update": {
"allowed_updates": [
"email",
"tax_id"
],
"enabled": true
},
"invoice_history": {
"enabled": true
},
"payment_method_update": {
"enabled": false
},
"subscription_cancel": {
"cancellation_reason": {
"enabled": false,
"options": [
"too_expensive",
"missing_features",
"switched_service",
"unused",
"other"
]
},
"enabled": false,
"mode": "at_period_end",
"proration_behavior": "none"
},
"subscription_update": {
"default_allowed_updates": [],
"enabled": false,
"proration_behavior": "none"
}
},
"is_default": false,
"livemode": false,
"login_page": {
"enabled": false,
"url": null
},
"metadata": {},
"updated": 1688593779
}

Retrieve a portal configuration 

Retrieves a configuration that describes the functionality of the customer portal.

Parameters

No parameters.

Returns

Returns a portal configuration object.

GET /v1/billing_portal/configurations/:id
curl https://api.stripe.com/v1/billing_portal/configurations/bpc_1MrnZsLkdIwHu7ixNiQL1xPM \
-u "sk_test_BQokikJ...2HlWgH4olfQ2sk_test_BQokikJOvBiI2HlWgH4olfQ2:"
Response
{
"id": "bpc_1MrnZsLkdIwHu7ixNiQL1xPM",
"object": "billing_portal.configuration",
"active": true,
"application": null,
"business_profile": {
"headline": null,
"privacy_policy_url": null,
"terms_of_service_url": null
},
"created": 1680290736,
"default_return_url": null,
"features": {
"customer_update": {
"allowed_updates": [
"email",
"tax_id"
],
"enabled": true
},
"invoice_history": {
"enabled": true
},
"payment_method_update": {
"enabled": false
},
"subscription_cancel": {
"cancellation_reason": {
"enabled": false,
"options": [
"too_expensive",
"missing_features",
"switched_service",
"unused",
"other"
]
},
"enabled": false,
"mode": "at_period_end",
"proration_behavior": "none"
},
"subscription_update": {
"default_allowed_updates": [],
"enabled": false,
"proration_behavior": "none"
}
},
"is_default": false,
"livemode": false,
"login_page": {
"enabled": false,
"url": null
},
"metadata": {},
"updated": 1680290736
}

List portal configurations 

Returns a list of configurations that describe the functionality of the customer portal.

Parameters

  • activeboolean

    Only return configurations that are active or inactive (e.g., pass true to only list active configurations).

  • is_defaultboolean

    Only return the default or non-default configurations (e.g., pass true to only list the default configuration).

More parameters

  • ending_beforestring

  • limitinteger

  • starting_afterstring

Returns

Returns a list of portal configuration objects.

GET /v1/billing_portal/configurations
curl -G https://api.stripe.com/v1/billing_portal/configurations \
-u "sk_test_BQokikJ...2HlWgH4olfQ2sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \
-d limit=3
Response
{
"object": "list",
"url": "/v1/billing_portal/configurations",
"has_more": false,
"data": [
{
"id": "bpc_1MrnZsLkdIwHu7ixNiQL1xPM",
"object": "billing_portal.configuration",
"active": true,
"application": null,
"business_profile": {
"headline": null,
"privacy_policy_url": null,
"terms_of_service_url": null
},
"created": 1680290736,
"default_return_url": null,
"features": {
"customer_update": {
"allowed_updates": [
"email",
"tax_id"
],
"enabled": true
},
"invoice_history": {
"enabled": true
},
"payment_method_update": {
"enabled": false
},
"subscription_cancel": {
"cancellation_reason": {
"enabled": false,
"options": [
"too_expensive",
"missing_features",
"switched_service",
"unused",
"other"
]
},
"enabled": false,
"mode": "at_period_end",
"proration_behavior": "none"
},
"subscription_update": {
"default_allowed_updates": [],
"enabled": false,
"proration_behavior": "none"
}
},
"is_default": false,
"livemode": false,
"login_page": {
"enabled": false,
"url": null
},
"metadata": {},
"updated": 1680290736
}
]
}

Invoices 

Invoices are statements of amounts owed by a customer, and are either generated one-off, or generated periodically from a subscription.

They contain invoice items, and proration adjustments that may be caused by subscription upgrades/downgrades (if necessary).

If your invoice is configured to be billed through automatic charges, Stripe automatically finalizes your invoice and attempts payment. Note that finalizing the invoice, when automatic, does not happen immediately as the invoice is created. Stripe waits until one hour after the last webhook was successfully sent (or the last webhook timed out after failing). If you (and the platforms you may have connected to) have no webhooks configured, Stripe waits one hour after creation to finalize the invoice.

If your invoice is configured to be billed by sending an email, then based on your email settings, Stripe will email the invoice to your customer and await payment. These emails can contain a link to a hosted page to pay the invoice.

Stripe applies any customer credit on the account before determining the amount due for the invoice (i.e., the amount that will be actually charged). If the amount due for the invoice is less than Stripe’s minimum allowed charge per currency, the invoice is automatically marked paid, and we add the amount due to the customer’s credit balance which is applied to the next invoice.

More details on the customer’s credit balance are here.

Related guide: Send invoices to customers