Skip to main content

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.*.namestringRequired
products.*.productIdstringOptional, max length 25
products.*.quantitynumericRequired
products.*.ratenumericRequired
products.*.discountnumericOptional
products.*.taxnumericRequired
products.*.amountnumericRequired
billingFrequencystringRequired (e.g., monthly, weekly, daily)
numberOfRepeatsnumericRequired
orderSummary.subTotalnumericRequired
orderSummary.totalTaxnumericRequired
orderSummary.totalDiscountnumericRequired
orderSummary.grandTotalnumericRequired
orderSummary.payablePerCyclenumericRequired
subscriptionStartDatestringRequired
subscriptionEndsDatestringRequired
dueDateForPaymentLinkstringRequired
customerDetails.typestringRequired (nullable)
customerDetails.countryCodestringRequired (nullable)
customerDetails.msisdnstringRequired (nullable)
customerDetails.emailemailRequired (nullable)
customerDetails.namestringRequired
customerDetails.personalNumberstringOptional, regex /^\d{11}$/
customerDetails.organizationIdstringRequired if type=corporate, Optional, regex /^[a-zA-Z0-9]+$/
customerDetails.preferredLanguagestringRequired
customerDetails.addressarrayRequired
customerDetails.address.streetstringRequired
customerDetails.address.zipstringRequired
customerDetails.address.citystringRequired
customerDetails.address.countrystringRequired, ISO Alpha-2 country code
customerNotesstringOptional
termsAndConditionsstringOptional
submitPayment.currencystringRequired
submitPayment.viastringOptional
settingsarrayOptional
settings.secureDetailsbooleanOptional
callback.successurlRequired
callback.failureurlRequired
:contentReference[oaicite:4]{index=4}

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"
        }
      ]
    }