General

Customer Portal

 

Create a link for a customer so that they can manage their subscriptions, billing details, invoices and payment methods.

Request

Request to generate a customer postal page session URL.

Path

POST /customer-portal/link

Example (No Subscription)

The example below only includes the customer_id. When no subscription_id is provided, the customer will be presented with the available packages and can create a new subscription.

{
  "customer_id": "cus_abc123...",
}

Example (Subscription)

The example below includes both the customer_id and subscription_id. This allows the customer to manage a specific subscription. If the subscription is inactive, the customer will have the option to reactivate it.

{
  "customer_id": "cus_abc123...",
  "subscription_id": "sub_abc123...",
}

Example (Advanced settings)

The example below demonstrates how to override the default settings configured in the dashboard. This can be useful when you need to disable specific features for certain customers or subscriptions, or when different products should be displayed for a particular subscription.

Note that the default settings can be updated on the portal under Settings -> Customer Portal.

{
  "customer_id": "cus_abc123...",
  "subscription_id": "sub_abc123...",
  "settings": {
    "show_invoices": true, // allow the user to view the invoices
    "billing_info_type": "UPDATE", // Allow the user to update billing info on page
    "cancel_type": "END_OF_PERIOD", // The plan will be scheduled to be canceled at the end of the billing period
    "plan_change_type": "SMART", // When a plan is changed, how should the calculations be handled
    "available_product_ids": ["pro_abc123...", "pro_abc123..."], // Specify available products that the user can select as a plan. This will be grouped by interval and ordered from the smallest amount to largest
    "redirect_url": "https://my-portal.site.com", // Back to site link
    "page_title": "My SaaS business" // Specify the left side page title
  }
}

Request Parameters

Request field details. Y = always required, C = conditional, N = optional.

Field
RequiredType
Description
Example
customer_idYStringThe customer the portal link is generated forcus_abc123...
subscription_idNStringManage a specific subscription. If omitted, the customer can select a package to create a new subscription. If the subscription is inactive, the user can reactivate it.sub_abc123...
settingsNObjectOverride the default portal settings. Omit to use your account defaults.See advanced example
settings.show_invoicesNBooleanAllow the user to view their invoicestrue
settings.billing_info_typeNENUMControls access to billing information. Available values: NONE, VIEW, UPDATE.UPDATE
settings.cancel_typeNENUMControls subscription cancellation. Available values: NONE, IMMEDIATE, END_OF_PERIOD.END_OF_PERIOD
settings.plan_change_typeNENUMControls how subscription plan changes are handled. Available values: NONE, IMMEDIATE, END_OF_PERIOD, SMART.SMART
settings.available_product_idsNArrayProduct IDs available for selection. Products are grouped by billing interval and ordered from the lowest price to the highest price."pro_abc123...", "pro_def456..."
settings.redirect_urlNStringWhere the user is redirected when they select Back to Site or close the portal.https://my-portal.site.com
settings.page_titleNStringOverride the page title displayed on the left side of the portal.My SaaS business

billing_info_type

ValueDescription
NONEHide billing information
VIEWAllow the user to view billing information
UPDATEAllow the user to view and update billing information

cancel_type

ValueDescription
NONESubscription cannot be cancelled
IMMEDIATECancel the subscription immediately
END_OF_PERIODCancel the subscription when the current billing period ends

plan_change_type

ValueDescription
NONESubscription plan cannot be changed
IMMEDIATEAny plan change takes effect immediately
END_OF_PERIODAny plan change takes effect when the current billing period ends
SMARTUpgrades take effect immediately with prorated billing. Downgrades take effect when the current billing period ends.

Response Body

{
    "status": true,
    "result": {
      "id": "cpl_HVpCeoNys1f22X7QcuWHY",
      "session_id": "ses_G-xkVKoxHgEBrY8suKgR3",
      "customer_id": "cus_abc123...",
      "subscription_id": "sub_abc123...",
      "link_url": "https://pay.kwik.co.za/portal/a0oDxntJxWlA8LjfOR9bgck9C4w....",
      "expires_at": "2026-03-13T12:30:00Z"
    }
}

Response Parameters

Field
Type
Description
Example
statusBooleanIndicates if the request was successfultrue
result.idStringUnique customer portal link identifiercpl_HVpCeoNys1f22X7QcuWHY
result.session_idString(32)Session identifier for the portal linkses_G-xkVKoxHgEBrY8suKgR3
result.customer_idString(32)Associated customer IDcus_abc123...
result.subscription_idString(32)Associated subscription ID, when a subscription_id was suppliedsub_abc123...
result.link_urlStringURL to redirect the user to the customer portalhttps://pay.kwik.co.za/portal/a0oDxntJxWlA8LjfOR9bgck9C4w....
result.expires_atStringISO timestamp when the portal link expires2026-03-13T12:30:00Z