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/subscription/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])