Skip to main content

Request Refund Approval

Retrieve Product ID from Get Order Details API using reference. In the message field you need to pass the message why you can not complete the refund via regular refund flow, better to add the exact message received while trying to refund with the regular endpoint.

Endpoint

:

https://demo-api.frontpayment.no/api/v1/orders/refund/request/approval/{{ORDER_UUID}}

Method

:

POST

Authorization

:

Bearer

Payload Validation

:

 

'type' => 'required|string|in:regular,invoiced,reservation',
'grandTotal' => 'required|numeric',
'message' => 'required|string',
'products' => 'required|array',
'products.*.id' => 'required|numeric',
'products.*.amount' => 'required|numeric',
'source' => 'nullable|string|in:captured",charged|requiredIf('type') === reservation',
'reference' => 'nullable|string|requiredIf('type') === reservation

Example Payload

:

 

{
    "type": "reservation",
    "grandTotal": 55,
    "message": "refundRejectionForWeeklyThresholdExceed",
    "products": [
        {
            "id": 451,
            "amount": 30
        },
        {
            "id": 452,
            "amount": 25
        }
    ],
    "source": "charged",
    "reference": "CHA3852658817"
}

 

Response Structure

:

 

// Success
{
    "status_code": 201,
    "status_message": "OK",
    "message": "requestedOrderRefundSuccessfully",
    "is_data": false,
    "data": null
}

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

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

{
    "status_code": 400,
    "status_message": "Conflict of Business Logic",
    "message": "refundRejectionForRefundedCancelledInvoicedOrderParamRefunded",
    "is_data": false,
    "data": null
}

{
    "status_code": 400,
    "status_message": "Conflict of Business Logic",
    "message": "requestProductIdNotAvailable",
    "is_data": false,
    "data": null
}

{
    "status_code": 400,
    "status_message": "Conflict of Business Logic",
    "message": "refundRejectionForRefundedCancelledInvoicedOrderParamCancelled",
    "is_data": false,
    "data": null
}

{
    "status_code": 400,
    "status_message": "Conflict of Business Logic",
    "message": "refundRejectionForRefundedCancelledInvoicedOrderParamInvoiced",
    "is_data": false,
    "data": null
}

{
    "status_code": 400,
    "status_message": "Conflict of Business Logic",
    "message": "orderRefundRequestAlreadySubmitted",
    "is_data": false,
    "data": null
}

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

 

Example Response

:

 

 

{
    "status_code": 201,
    "status_message": "OK",
    "message": "requestedOrderRefundSuccessfully",
    "is_data": false,
    "data": null
}