Subscription Management
- Create Subscription
- Create Session For Subscription Payment
- Get Subscription List
- Get Failed Payment List
- Get Subscription Details By Uuid
- Get Failed Payment Details
- Resend Subscription
- Cancel Subscription
- Refund Subscription Cycle
Create Subscription
Use this API to create a new subscription. After a successful request, the response will include a payment link that you must redirect your customer to in order to complete the subscription setup.
Endpoint
POST https://demo-api.frontpayment.no/api/v1/connect/subscriptions/submit
Authentication
This endpoint requires a Bearer Token for authentication. You will need to obtain this token from Front Payment and include it in the Authorization header of your request.
Request Payload
The request body should be a JSON object including the following elements:
{
"products": [
{
"name": "string",
"productId": "string or null",
"quantity": number,
"rate": number,
"discount": number (optional),
"tax": number,
"amount": number
}
],
"billingFrequency": "string",
"numberOfRepeats": number,
"orderSummary": {
"subTotal": number,
"totalTax": number,
"totalDiscount": number,
"grandTotal": number,
"payablePerCycle": number
},
"subscriptionStartDate": "string",
"subscriptionEndsDate": "string",
"dueDateForPaymentLink": "string",
"sendOrderBy": {
"sms": boolean,
"email": boolean
},
"customerDetails": {
"type": "string or null",
"countryCode": "string or null",
"msisdn": "string or null",
"email": "string or null (must be email format)",
"name": "string",
"personalNumber": "string or null",
"organizationId": "string or null (when type=corporate)",
// (other fields like preferredLanguage or address may apply in checkout session—refer to specific endpoints)
}
}
Validation Rules
The following table outlines validation constraints for each field in the request payload:
| Field | Type | Description |
|---|---|---|
products.*.name |
string |
Required. Name of the product. |
products.*.productId |
string |
Optional. Unique identifier for the product. |
products.*.quantity |
numeric |
Required. Quantity of the product. |
products.*.rate |
numeric |
Required. Rate per unit of the product. |
products.*.discount |
numeric |
Optional. Discount applied to the product. |
products.*.tax |
numeric |
Required. Tax rate (e.g., 0, 12, 15, 25). Unless you have other configuration. |
products.*.amount |
numeric |
Required. Total amount for the product line item. |
billingFrequency |
string |
Required Defines how often the billing occurs (e.g., daily, weekly, monthly) |
numberOfRepeats |
numeric |
RequiredSpecifies how many times the billing cycle should be repeated. |
orderSummary.subTotal |
numeric |
Required. Subtotal of all products before tax and discount. |
orderSummary.totalTax |
numeric |
Required. Total tax for the order. |
orderSummary.totalDiscount |
numeric |
Required. Total discount for the order. |
orderSummary.grandTotal |
numeric |
Required. Grand total of the order. |
orderSummary.payablePerCycle |
numeric |
RequiredAmount to be paid by the customer for each billing cycle. |
subscriptionStartDate |
string |
Required The date when the subscription becomes active. |
subscriptionEndsDate |
string |
Required The end date of subscription |
dueDateForPaymentLink |
string |
Required. Unix timestamp for the due date of the payment link. |
sendOrderBy.sms |
boolean |
Required If the payment link should send via sms |
sendOrderBy.email |
boolean |
Required If the payment link should send via email |
customerDetails.type |
string |
Required. Customer type must be either private or corporate. |
customerDetails.countryCode |
string |
Required. Country code for the customer's phone number (e.g., "+47") |
customerDetails.msisdn |
string |
Required. Mobile Subscriber ISDN Number (phone number). |
customerDetails.email |
email |
Required. Customer's email address. |
customerDetails.name |
string |
Required. Customer's full name. |
customerDetails.personalNumber |
string |
Optional Customer's personal identification number, must be 11 characters |
customerDetails.organizationId |
string |
Required if customerDetails.type is corporate. Must be number |
Responses
Successful Response
On success, you’ll receive a JSON response containing the status and a payment link to redirect the user:
{
"status_code": 200,
"status_message": "OK",
"message": "subscriptionCreatedSuccessfully",
"is_data": true,
"data": {
"paymentLink": "https://…",
"subscriptionUuid": "…",
"orderUuid": "…",
// Possibly other metadata
}
}
You must redirect the customer to paymentLink to finalize the subscription. ([docs.frontpayment.no][1])
Error Responses
Create Session For Subscription Payment
Use this API endpoint to create a new subscription using the checkout modality. Upon a successful request, you'll receive a paymentUrl that your application must redirect the customer to in order to complete the subscription setup.
Endpoint
- URL:
https://demo-api.frontpayment.no/api/v1/connect/subscription/create([docs.frontpayment.no][2]) - Method:
POST
Authentication
Requires Bearer Token authentication. Include the token in the Authorization header:
Authorization: Bearer YOUR_ACCESS_TOKEN
If the token is missing or invalid, the API returns a 401 Unauthorized response. ([docs.frontpayment.no][1])
Request Payload
The body must be JSON and include fields such as products, billing schedule, customer details, callback URLs, etc. Here's a condensed example:
{
"products": {
"0": {
"name": "product 3",
"productId": null,
"quantity": "1",
"rate": "2000",
"discount": 0,
"tax": "0",
"amount": 2000
}
},
"orderSummary": {
"subTotal": "2000.00",
"totalTax": "0.00",
"totalDiscount": "0.00",
"grandTotal": "2000.00",
"payablePerCycle": "2000.00"
},
"billingFrequency": "month",
"numberOfRepeats": 12,
"subscriptionStartDate": "21 Feb, 2023",
"subscriptionEndsDate": "21 Feb, 2024",
"dueDateForPaymentLink": "1677047770.652",
"customerDetails": {
"customerUuid": "CSRT3798554634",
"type": "private",
"countryCode": "+47",
"msisdn": "46567468",
"email": "[email protected]",
"name": "Kari Nordmann",
"personalNumber": null,
"organizationId": "925710482",
"preferredLanguage": "no",
"address": {
"street": "Luramyrveien 65",
"zip": "4313",
"city": "Sandnes",
"country": "Norway"
}
},
"customerNotes": "test",
"termsAndConditions": "terms and conditions",
"submitPayment": {
"via": "visa",
"currency": "NOK"
},
"callback": {
"success": "https://demo.frontpayment.no/?order_identifier=...&order_status=success",
"failure": "https://demo.frontpayment.no/?order_identifier=...&order_status=failed"
}
}
([docs.frontpayment.no][1])
Validation Rules
Below are the validation constraints for each field:
| Field | Type | Description |
|---|---|---|
products.*.name | string | Required |
products.*.productId | string | Optional, max length 25 |
products.*.quantity | numeric | Required |
products.*.rate | numeric | Required |
products.*.discount | numeric | Optional |
products.*.tax | numeric | Required |
products.*.amount | numeric | Required |
billingFrequency | string | Required (e.g., monthly, weekly, daily) |
numberOfRepeats | numeric | Required |
orderSummary.subTotal | numeric | Required |
orderSummary.totalTax | numeric | Required |
orderSummary.totalDiscount | numeric | Required |
orderSummary.grandTotal | numeric | Required |
orderSummary.payablePerCycle | numeric | Required |
subscriptionStartDate | string | Required |
subscriptionEndsDate | string | Required |
dueDateForPaymentLink | string | Required |
customerDetails.type | string | Required (nullable) |
customerDetails.countryCode | string | Required (nullable) |
customerDetails.msisdn | string | Required (nullable) |
customerDetails.email | email | Required (nullable) |
customerDetails.name | string | Required |
customerDetails.personalNumber | string | Optional, Customer's personal identification number, must be 11 characters. |
customerDetails.organizationId | string | Required if type=corporate, Optional, regex /^[a-zA-Z0-9]+$/ |
customerDetails.preferredLanguage | string | Required |
customerDetails.address | array | Required |
customerDetails.address.street | string | Required |
customerDetails.address.zip | string | Required |
customerDetails.address.city | string | Required |
customerDetails.address.country | string | Required, ISO Alpha-2 country code |
customerNotes | string | Optional |
termsAndConditions | string | Optional |
submitPayment.currency | string | Required |
submitPayment.via | string | Optional |
settings | array | Optional |
settings.secureDetails | boolean | Optional |
callback.success | url | Required |
callback.failure | url | Required |
Response
Success
Returns HTTP status 201 with a payload like:
{
"status_code": 201,
"status_message": "OK",
"message": "subscriptionRequestSuccessfullyHandled",
"is_data": true,
"data": {
"subscriptionUuid": "SUB1812030514",
"orderUuid": "ODR3798113293",
"customerUuid": "CSRT3820359602",
"paymentUrl": "https://..."
}
}
([docs.frontpayment.no][1])
Error Responses
-
510 Execution Exception – Internal processing error:
{ "status_code": 510, "status_message": "Execution Exception Occurred", "message": "Internal Error Occurred Please Try Again Later", "is_error": true, "errors": [...] } -
500 Internal Dependency Error – Critical failure in dependency:
{ "status_code": 500, "status_message": "Internal Dependency Error", "message": "Internal Error Occurred Please Try Again Later", "is_error": true, "errors": [ { "happenedAt": "String", "internalErrorDetails": "String" } ] }
Get Subscription List
Description:
Retrieves a paginated list of subscriptions. The response includes details of each subscription, and filtering options can be applied via query parameters.
Url Parameter Parameters:
status(string, optional) – Filter subscriptions by status (e.g.,SENT,ONGOING,COMPLETED, CANCELLED).
Query Parameters:
page(integer, optional) – The page number for pagination. Default:1.phone(string, optional) – Filter subscriptions by phone.customerName(string, optional) – Retrieve subscriptions associated with a specific customer.startDate(date, optional) – Filter subscriptions that started on or after this date (Format:YYYY-MM-DD).endDate(date, optional) – Filter subscriptions that ended on or before this date (Format:YYYY-MM-DD). startDate and endDate should be used together.
Authentication
This endpoint requires authentication using a Bearer Token. The client must send the token in the Authorization header for every request.
Example Authentication Header:
If the token is missing or invalid, the API will return a 401 Unauthorized response.
| Endpoint | : | https://demo-api.frontpayment.no/api/v1/connect/subscriptions/list/{status?} |
| Method | : | GET |
| Authorization | : | Bearer |
|
Response Structure |
: |
|
|
Example Response |
: |
|
Get Failed Payment List
Description:
Retrieves a paginated list of failed subscription orders. The response includes details of each subscription order, and filtering options can be applied via query parameters.
Url Parameter Parameters:
status(string, optional) – Filter subscriptions by status (e.g., paid, invoiced, debtCollection).
Query Parameters:
page(integer, optional) – The page number for pagination. Default:1.subscriptionUuid(string, optional) – Retrieve subscriptions associated with a specific subscription.phone(string, optional) – Filter subscriptions order by customer phone.customerName(string, optional) – Retrieve subscriptions associated with a specific customer name.startDate(date, optional) – Filter subscription order that started on or after this date (Format:YYYY-MM-DD).endDate(date, optional) – Filter subscription order that ended on or before this date (Format:YYYY-MM-DD). startDate and endDate should be used together.
Authentication
This endpoint requires authentication using a Bearer Token. The client must send the token in the Authorization header for every request.
Example Authentication Header:
If the token is missing or invalid, the API will return a 401 Unauthorized response.
| Endpoint | : | https://demo-api.frontpayment.no/api/v1/connect/subscriptions/failed/list/{status?} |
| Method | : | GET |
| Authorization | : | Bearer |
|
Response Structure |
: |
|
|
Example Response |
: |
|
Get Subscription Details By Uuid
Description:
Retrieves a subscription by uuid. The response includes details of the subscription.
Url Parameter Parameters:
subscriptionUuid(string, required)
Authentication
This endpoint requires authentication using a Bearer Token. The client must send the token in the Authorization header for every request.
Example Authentication Header:
If the token is missing or invalid, the API will return a 401 Unauthorized response.
| Endpoint | : | https://demo-api.frontpayment.no/api/v1/connect/subscriptions/details/{subscriptionUuid} |
| Method | : | GET |
| Authorization | : | Bearer |
| Payload Validations | : | |
| Example Payload | : | |
| Response Structure | : |
|
| Example Response | : |
|
Get Failed Payment Details
Description:
Retrieves a failed subscription order by orderUuid. The response includes details of the failed subscription order.
Url Parameter Parameters:
orderUuid(string, required)
Authentication
This endpoint requires authentication using a Bearer Token. The client must send the token in the Authorization header for every request.
Example Authentication Header:
If the token is missing or invalid, the API will return a 401 Unauthorized response.
| Endpoint | : | https://demo-api.frontpayment.no/api/v1/connect/subscriptions/failed/details/{orderUuid} |
| Method | : | GET |
| Authorization | : | Bearer |
| Payload Validation | : | |
| Response Structure | : |
|
| Example Response | : |
|
Resend Subscription
Description:
Resend subscription payment link.
Url Parameter Parameters:
subscriptionUuid(string, required) – Resend the subscription order.
| Endpoint | : | https://demo-api.frontpayment.no/api/v1/connect/subscriptions/resend/{subscriptionUuid} |
| Method | : | POST |
| Request Payload | : |
|
| Response Structure | : |
|
| Response Example | : |
|
Cancel Subscription
Description
Cancel a subscription by uuid. Only SEND and ONGOING subscription can be cancelled
| Endpoint | : | https://demo-api.frontpayment.no/api/v1/connect/subscriptions/cancel/{subscriptionUuid} |
| Method | : | POST |
| Authorization | : | Bearer |
| Request Payload | : |
|
| Response Structure | : |
|
| Example Response | : |
|
Refund Subscription Cycle
Description:
Refund a specific order or cycle of a subscription
Url Parameter Parameters:
- subscriptionUuid (string, required) – Uuid Of Subscription
Authentication
This endpoint requires authentication using a Bearer Token. The client must send the token in the Authorization header for every request.
Example Authentication Header:
If the token is missing or invalid, the API will return a 401 Unauthorized response.
| Endpoint | : | https://demo-api.frontpayment.no/api/v1/connect/subscriptions/cycles/refund/{subscriptionUuid} |
| Method | : | POST |
| Authorization | Bearer | |
| Request Payload | : |
|
| Response Structure | : |
|
| Example Response | : |
|