Customer Portal Sessions
Create a customer portal session
POSThttps://api.paynow.gg/v1/stores/{storeId}/customers/{customerId}/portal-sessions
Creates a customer portal session from a secure server using an API Key. The returned session contains the token and URL to hand to the customer.
Headers
AuthorizationAPI KeyRequired
Authentication token for this request, sent as
Authorization: APIKey TOKEN.Path parameters
storeIdFlakeIdRequired
The ID of the store to create the portal session for.
customerIdFlakeIdRequired
The ID of the customer to create the portal session for.
Request body
flowCustomerPortalSessionFlowDtoRequiredThe flow a customer portal session is scoped to. At most one of the flows is set.
subscription_cancelSubscriptionCancelFlowDtoOptionalPortal flow for cancelling a specific subscription
subscription_idFlakeIdRequired
subscription_payment_method_updateSubscriptionPaymentMethodUpdateFlowDtoOptionalPortal flow for updating the payment method of a specific subscription
subscription_idFlakeIdRequired
expires_in_secondsintegerOptional
How long the portal session stays valid, in seconds. When unset, a default expiry is used.
return_urlstringOptional
URL to redirect the customer back to after completing the portal flow
Response
200OKCustomerPortalSessionDto
Represents a customer portal session
Show fieldsHide fields
created_atstringRequired
Date and time when the portal session was created
customer_idFlakeIdRequired
expires_atstringRequired
Date and time when the portal session expires
idFlakeIdRequired
store_idFlakeIdRequired
flowCustomerPortalSessionFlowDtoOptionalThe flow a customer portal session is scoped to. At most one of the flows is set.
subscription_cancelSubscriptionCancelFlowDtoOptionalPortal flow for cancelling a specific subscription
subscription_idFlakeIdRequired
subscription_payment_method_updateSubscriptionPaymentMethodUpdateFlowDtoOptionalPortal flow for updating the payment method of a specific subscription
subscription_idFlakeIdRequired
return_urlstringOptional
URL to redirect the customer back to after completing the portal flow
tokenstringOptional
The token used to access the portal session
urlstringOptional
The URL to redirect the customer to for this portal session
Failed requests return a PayNowError body. See the error response guide.
curl -X POST "https://api.paynow.gg/v1/stores/{storeId}/customers/{customerId}/portal-sessions" \
-H "Authorization: APIKey TOKEN" \
-H "Content-Type: application/json" \
-d '{
"flow": {
"subscription_cancel": {
"subscription_id": "411486491630370816"
},
"subscription_payment_method_update": {
"subscription_id": "411486491630370816"
}
},
"expires_in_seconds": 0,
"return_url": "string"
}'import { createManagementClient } from "@paynow-gg/typescript-sdk";
const paynow = createManagementClient({
apiKey: "API_KEY",
storeId: "STORE_ID",
});
const result = await paynow.customer_portal_sessions.createCustomerPortalSession("411486491630370816", {
flow: {
subscription_cancel: {
subscription_id: "411486491630370816",
},
subscription_payment_method_update: {
subscription_id: "411486491630370816",
},
},
expires_in_seconds: 0,
return_url: "string",
});import requests
headers = {"Authorization": "APIKey TOKEN"}
payload = {
"flow": {
"subscription_cancel": {
"subscription_id": "411486491630370816",
},
"subscription_payment_method_update": {
"subscription_id": "411486491630370816",
},
},
"expires_in_seconds": 0,
"return_url": "string",
}
response = requests.post("https://api.paynow.gg/v1/stores/{storeId}/customers/{customerId}/portal-sessions", headers=headers, json=payload)Response200
{
"created_at": "2024-01-01T00:00:00Z",
"customer_id": "411486491630370816",
"expires_at": "2024-01-01T00:00:00Z",
"id": "411486491630370816",
"store_id": "411486491630370816",
"flow": {
"subscription_cancel": {
"subscription_id": "411486491630370816"
},
"subscription_payment_method_update": {
"subscription_id": "411486491630370816"
}
},
"token": "string",
"url": "string",
"return_url": "string"
}