Billing portal
The billing_portal.session object
A billing portal session gives one customer short-lived access to the hosted billing portal. Create one when the customer asks to manage their billing, then redirect them to its url.
Attributes
idstringRequiredUnique identifier for the object.
objectstringRequiredString naming the object's type.
livemodebooleanRequiredtruewhen the object exists in live mode,falsein test mode.createdtimestampRequiredTime the object was created, in Unix seconds.
configurationstringRequiredID of the portal configuration the session runs under: the one named in the request, otherwise the default configuration of the mode.
customerstringRequiredID of the customer the session is for. The portal shows and changes only this customer's data.
return_urlstringURL the portal's return link sends the customer to: the
return_urlof the request, otherwise the configuration'sdefault_return_url. Empty when neither is set.localestringLanguage set for the session:
en,thorauto. Documents the customer downloads from the portal are in Thai forthand in English otherwise. Empty when not set.enEnglish.
thThai.
autoNo fixed language. Documents downloaded from the portal are in English.
flowobjectRequiredNullableThe single action the session is limited to, or
nullfor a full portal session. With a flow, the portal opens directly on that action and shows no other navigation.Show child attributes
flow.typestringRequiredThe action the session is limited to.
payment_method_updateOpen the portal on the customer's payment methods, to add one or change the default.
subscription_cancelOpen the portal on the cancellation of
subscription.subscription_updateOpen the portal on the plan change of
subscription.subscription_update_confirmOpen the portal on the plan change of
subscriptionfor the change described initems.
flow.subscriptionstringID of the subscription the flow acts on. Set for every flow type except
payment_method_update; it belongs to the session's customer.flow.itemsarray of objectsFor
subscription_update_confirm, the subscription item to change and the price and quantity to change it to. Holds at most one item.Show child attributes
flow.items.idstringID of the subscription item to change.
flow.items.pricestringID of the price to switch the item to.
flow.items.quantityintegerNew quantity of the item.
flow.couponstringCoupon ID saved with the flow. The portal does not currently apply it.
flow.promotion_codestringPromotion code ID saved with the flow. The portal does not currently apply it.
flow.after_completionobjectRequiredWhat the portal does once the customer completes the action.
Show child attributes
flow.after_completion.typestringRequiredThe behavior after completion.
hosted_confirmationShow a confirmation screen in the portal, with
custom_messagewhen set.redirectSend the customer to
return_urlonce the flow finishes.portal_homepageThe default when no type is given. The portal ends the flow on its standard completion screen.
flow.after_completion.custom_messagestringMessage shown on the completion screen instead of the standard text. Empty when not set.
flow.after_completion.return_urlstringURL the customer is sent to when
typeisredirect.
expires_attimestampNullableTime the session expires, in Unix seconds. The URL must be opened within 5 minutes of creation; each request the customer makes in the portal then extends the session to one hour after that activity.
urlstringURL of the hosted portal for this session; redirect the customer to it. It contains the session secret, so it is returned only in the response to the create request (never in webhook events) and should not be logged or shared.