Skip to main content

Create Session For Subscription Payment

Use thethis followingAPI endpoint and payload to create a new subscription forusing the checkout modality. After gettingUpon a successful responserequest, youyou'll needreceive a paymentUrl that your application must redirect the customer to redirectin order to complete the givensubscription payment link which is given in response payload.setup.

Endpoint

  • URL: https://demo-api.frontpayment.no/api/v1/connect/subscription/create ([docs.frontpayment.no][2])
  • Method: POST

Authentication

This endpoint requires authentication using aRequires Bearer Token. Theauthentication. client must sendInclude the token in the Authorization header for every request.header:

Example Authentication Header:

Authorization: Bearer YOUR_ACCESS_TOKEN

If the token is missing or invalid, the API will returnreturns a 401 Unauthorized response. ([docs.frontpayment.no][1])

Request Payload

The

([docs.frontpayment.no][1])

Validation Rules

Below are the validation constraints for each field:

Endpoint:https://demo-api.frontpayment.no/api/v1/connect/subscription/create
Method:POST
Authorization:Bearer
Payload Validations
'products.*.name' => 'required|string',
'products.*.productId' => 'nullable|string|max:25',
'products.*.quantity' => 'required|numeric',
'products.*.rate' => 'required|numeric',
'products.*.discount' => 'nullable|numeric',
'products.*.tax' => 'required|numeric',
'products.*.amount' => 'required|numeric',
'billingFrequency' => 'required|string', //(eg: monthly, weekly, daily)
'numberOfRepeats' => 'required|numeric',
'orderSummary.subTotal' => 'required|numeric',
'orderSummary.totalTax' => 'required|numeric',
'orderSummary.totalDiscount' => 'required|numeric',
'orderSummary.grandTotal' => 'required|numeric',
'orderSummary.payablePerCycle' => 'required|numeric',
'subscriptionStartDate' => 'required|string',
'subscriptionEndsDate' => 'required|string',
'dueDateForPaymentLink' => 'required|string',
'customerDetails.type' => 'required|nullable|string',
'customerDetails.countryCode' => 'required|nullable|string',
'customerDetails.msisdn' => 'required|nullable|string',
'customerDetails.email' => 'required|nullable|email',
'customerDetails.name' => 'required|string',
'customerDetails.personalNumber' => 'nullable|string|regex:/^\d{11}$/',
'customerDetails.organizationId' => 'required_if:customerDetails.type,corporate|nullable|string|regex:/^[a-zA-Z0-9]+$/',
'customerDetails.preferredLanguage' => 'required|string',
'customerDetails.address' => 'required|array',
'customerDetails.address.street' => 'required|string',
'customerDetails.address.zip' => 'required|string',
'customerDetails.address.city' => 'required|string',
'customerDetails.address.country' => ['required', 'string', new IsoAlpha2Country("Country in Customer's Addressbody must be JSON and include fields such as ISOproducts, Alphabilling 2schedule, Standard")],customer 'customerNotes'details, =>callback 'nullable|string',URLs, 'termsAndConditions'etc. =>Here's 'nullable|string',a 'submitPayment.currency'condensed => 'required|string',
'submitPayment.via' => 'nullable|string',
'settings' => 'sometimes|array',
'settings.secureDetails' => 'sometimes|boolean',
'callback.success' => 'required|url',
'callback.failure' => 'required|url',
Example Payload: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=rRbl1FWZG59o...&order_status=success",
    "failure": "https://demo.frontpayment.no/?order_identifier=rRbl1FWZG59o...&order_status=failed"
  },
}

FieldTypeDescription
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

Structure

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://v1.checkout.bambora.com/a403d3df20af4888bd8f7dd38f3cd7f1"..."
  }
}

 ([docs.frontpayment.no][1])

{

Error "status_code":Responses

201,
    "status_message": "OK", "message": "subscriptionRequestSuccessfullyHandled", "is_data": Boolean, "data": { "subscriptionUuid": "String", "orderUuid": "String", "customerUuid":"String", "paymentUrl": "String" } }
  • 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": "Array"[...]
    }
    
  • 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"
        }
      ]
    }
    

  • Example  Response
     
    {
        "status_code": 201,
        "status_message": "OK",
        "message": "subscriptionRequestSuccessfullyHandled",
        "is_data": Boolean,
        "data": {
            "subscriptionUuid": "String",
             "orderUuid": "String",
             "customerUuid":"String",
            "paymentUrl": "String"
        }
    }