Skip to main content

Create Session For Subscription Payment

Use the following endpoint and payload to create a new subscription for checkout modality. After getting a successful response you need to redirect to the given payment link which is given in response payload.

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:

Authorization: Bearer YOUR_ACCESS_TOKEN

If the token is missing or invalid, the API will return a 401 Unauthorized response.

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 Address must be as ISO Alpha 2 Standard")],
'customerNotes' => 'nullable|string',
'termsAndConditions' => 'nullable|string',
'submitPayment.currency' => 'required|string',
'submitPayment.via' => 'nullable|string',
'settings' => 'sometimes|array',
'settings.secureDetails' => 'sometimes|boolean',
'callback.success' => 'required|url',
'callback.failure' => 'required|url',
Example Payload :
{
    "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"
    },
    "callback": {
        "success": "https://demo.frontpayment.no/?order_identifier=rRbl1FWZG59o&order_status=success",
        "failure": "https://demo.frontpayment.no/?order_identifier=rRbl1FWZG59o&order_status=failed"
    },
}

Response Structure
{
    "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"
    }
}

 

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

 

{
    "status_code": 510,
    "status_message": "Execution Exception Occurred",
    "message": "Internal Error Occurred Please Try Again Later",
    "is_error": true,
    "errors": "Array"
}
{
  "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"
    }
}