Skip to main content

Capture Reservation

RetrieveCapture Productthe IDpayment fromamount Getfor Reservationa reservation by calling this API. with the reservation's unique UUID and the required product information.


Endpoint

POST 

Request

the

Endpoint

:

https://demo-api.frontpayment.no/api/v1/connect/reservations/reservations/capture/{{RESERVATION_UUID}}

Method

:

POST

Authorization

:

Bearer

Payload Validation

:

 

'products' => 'required|array',
'products.*.id' => 'required|numeric',
'products.*.amount' => 'required|numeric',
'grandTotal' => 'required|numeric',
'additionalText' => 'nullable|string',

Authorization

To access this endpoint, include a Bearer Token in the Authorization header of your request. You can obtain this token from Frontpayment.

Example PayloadAuthorization Header: Authorization: Bearer YOUR_FRONTPAID_BEARER_TOKEN

Payload

:

Send
following

parameters as a JSON object in the request body:

{
    "products": {
        "0": {
            "id": 298,
            "amount": 5
        },
        "1": {
            "id": 299,
            "amount": 500
        },
        "2": {
            "id": 300,
            "amount": 150050
        }
    },
    "grandTotal": 2005,55,
    "additionalText" : "My additional Text for capture"
}

Retrieve Product ID from Get Reservation API

Validation Rules

Make sure your request meets the following requirements:

FieldTypeDescription
products.*.idnumeric**Required** Reservation product id. From which product you want to captured

Response Structure

products.*.amount

:

numeric
**Required** Captured amount for the product
grandTotalnumeric**Required** Grand total of the captured amount.
additionalTextstring**Optional** Captured note.

Response

A successful request will return a 202 OK status with the following JSON payload:

// Success
{
    "status_code": 202,
    "status_message": "OK",
    "message": "reservationCapturedSuccessfully",
    "is_data": true,
    "data": {
      "uuid": "String"
    }
}
//
Errors

API returns a 404 error, it means requested order with RESERVATION_UUID could not be found in our system.

{
    "status_code": 404,
    "status_message": "Not Found",
    "message": "reservationNotFound",
    "is_data": false,
    "data": null
}

API return a 417 error, it means request payload validation failed.

{
    "status_code": 417,
    "status_message": "Client Error",
    "message": "payloadValidationErrors",
    "is_error": true,
    "errors": "Array"
}

API returns a 510 error, it means something failed on the server side

{
    "status_code": 404,510,
    "status_message": "NotExecution Found"Exception Occurred",
    "message": "orderNotFound"Something Went Wrong",
    "is_data"is_error": false,true,
    "data"errors": null"Array"
}

Others rejections errors

{
    "status_code": 400,
    "status_message": "Conflict of Business Logic",
    "message": "requestedCaptureAmountExceedAvailableCaptureRunway",
    "is_data": false,
    "data": null
}
{
    "status_code": 400,
    "status_message": "Conflict of Business Logic",
    "message": "reservationStatusAlreadyCancelled",
    "is_data": false,
    "data": null
}
{
    "status_code": 400,
    "status_message": "Conflict of Business Logic",
    "message": "paymentCaptureDeadlineExceed",
    "is_data": false,
    "data": null
}
{
    "status_code": 500,
    "status_message": "Internal Dependency Error",
    "message": "internalErrorOccurredPleaseTryAgainLater",
    "is_error": true,
    "errors": "Array"
}

{
  "status_code": 510,
  "status_message": "Execution Exception Occurred",
  "message": "somethingWentWrong",
  "is_error": true,
  "errors": "Array"
}

 

Example Response

:

 

 

{
    "status_code": 202,
    "status_message": "OK",
    "message": "reservationCapturedSuccessfully",
    "is_data": true,
    "data": {
      "uuid": "CAP12345678"
    }
}