Orders .: Refund

API Reference / v15

Refund an Order

This endpoint refunds an order and returns the merchant-facing order data with with a non-null refunded_at key.

To refund an order, your app must have created the order and you must have a merchant access token with the manage_merchant_orders permission.

Request Endpoint

POST /v15/orders/:uuid/refund

Authorization Required – Merchant Token in Header

Authorization: token merchant="982-9a4218e4b6714b7b6b47890d0bf2f46544c99ff7a5957f72ef5637eaafdc73"

Request Body (Optional. Only required if merchant has manager_confirmation code set, which is uncommon)

  "refund": {
    "manager_confirmation": "87168"

Request Parameters

Param Type Required Description
manager_confirmation String or null No If the merchant uses one, the manager confirmation code used to authorize the refund.

cURL Example

curl -X POST https://sandbox.thelevelup.com/v15/orders/bf143c9084810132faf95a123bd6cde9/refund \
  -H Accept:application/json \
  -H Content-Type:application/json \
  -H 'Authorization:token merchant="982-9a4218e4b6714b7b6b47890d0bf2f46544c99ff7a5957f72ef5637eaafdc73"'

Example Response

HTTP/1.1 200 OK

  "order": {
      "created_at": "2015-01-22T11:29:22-05:00",
      "location_id": 19,
      "loyalty_id": 20,
      "refunded_at": "2015-01-22T14:28:05-05:00",
      "user_display_name": "TestCreds T.",
      "uuid": "bf143c9084810132faf95a123bd6cde9",
      "earn_amount": 0,
      "merchant_funded_credit_amount": 0,
      "spend_amount": 10,
      "tip_amount": 0,
      "total_amount": 10


HTTP/1.1 404 Not Found - The order does not exist

(Empty response body.)

HTTP/1.1 422 Unprocessable Entity - The order is unable to be refunded.

This error may occur perhaps because the order has already been refunded or because the original processing of the order failed to complete.

    "error": {
      "object": "order",
      "property": "base",
      "message": "The refund was unsuccessful. Perhaps this order has already been refunded or was unsuccessful."

HTTP/1.1 422 Unprocessable Entity - The manager confirmation is incorrect

    "error": {
      "object": "refund",
      "property": "manager_confirmation",
      "message": "Manager confirmation was incorrect."