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:
If the token is missing or invalid, the API will returnreturns a 401 Unauthorized
response. ([docs.frontpayment.no][1])
Request Payload
The
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
example:
|
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, regex /^\d{11}$/ |
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
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"
}
]
}
{
"status_code": 201,
"status_message": "OK",
"message": "subscriptionRequestSuccessfullyHandled",
"is_data": Boolean,
"data": {
"subscriptionUuid": "String",
"orderUuid": "String",
"customerUuid":"String",
"paymentUrl": "String"
}
}