Skip to Content
Paycose Docs
Billing portal

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

  • idstringRequired

    Unique identifier for the object.

  • objectstringRequired

    String naming the object's type.

  • livemodebooleanRequired

    true when the object exists in live mode, false in test mode.

  • createdtimestampRequired

    Time the object was created, in Unix seconds.

  • configurationstringRequired

    ID of the portal configuration the session runs under: the one named in the request, otherwise the default configuration of the mode.

  • customerstringRequired

    ID of the customer the session is for. The portal shows and changes only this customer's data.

  • return_urlstring

    URL the portal's return link sends the customer to: the return_url of the request, otherwise the configuration's default_return_url. Empty when neither is set.

  • localestring

    Language set for the session: en, th or auto. Documents the customer downloads from the portal are in Thai for th and in English otherwise. Empty when not set.

    • en

      English.

    • th

      Thai.

    • auto

      No fixed language. Documents downloaded from the portal are in English.

  • flowobjectRequiredNullable

    The single action the session is limited to, or null for a full portal session. With a flow, the portal opens directly on that action and shows no other navigation.

    Show child attributes
    • flow.typestringRequired

      The action the session is limited to.

      • payment_method_update

        Open the portal on the customer's payment methods, to add one or change the default.

      • subscription_cancel

        Open the portal on the cancellation of subscription.

      • subscription_update

        Open the portal on the plan change of subscription.

      • subscription_update_confirm

        Open the portal on the plan change of subscription for the change described in items.

    • flow.subscriptionstring

      ID 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 objects

      For 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.idstring

        ID of the subscription item to change.

      • flow.items.pricestring

        ID of the price to switch the item to.

      • flow.items.quantityinteger

        New quantity of the item.

    • flow.couponstring

      Coupon ID saved with the flow. The portal does not currently apply it.

    • flow.promotion_codestring

      Promotion code ID saved with the flow. The portal does not currently apply it.

    • flow.after_completionobjectRequired

      What the portal does once the customer completes the action.

      Show child attributes
      • flow.after_completion.typestringRequired

        The behavior after completion.

        • hosted_confirmation

          Show a confirmation screen in the portal, with custom_message when set.

        • redirect

          Send the customer to return_url once the flow finishes.

        • portal_homepage

          The default when no type is given. The portal ends the flow on its standard completion screen.

      • flow.after_completion.custom_messagestring

        Message shown on the completion screen instead of the standard text. Empty when not set.

      • flow.after_completion.return_urlstring

        URL the customer is sent to when type is redirect.

  • expires_attimestampNullable

    Time 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.

  • urlstring

    URL 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.