Skip to main content
POST
/
api
/
v2
/
payments
/
{id}
/
refunds
Refund a payment
curl --request POST \
  --url https://api.tabby.ai/api/v2/payments/{id}/refunds \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "amount": "0.00",
  "reference_id": "refund idempotency key",
  "reason": "Reason for the refund",
  "items": [
    {
      "reference_id": "SKU123",
      "title": "Name of the product",
      "description": "Description of the product",
      "quantity": 1,
      "unit_price": "0.00",
      "discount_amount": "0.00",
      "image_url": "https://example.com/",
      "product_url": "https://example.com/",
      "gender": "Kids",
      "category": "Clothes",
      "color": "white",
      "product_material": "cotton",
      "size_type": "EU",
      "size": "M",
      "brand": "Name of the Brand",
      "is_refundable": true,
      "barcode": "12345678",
      "ppn": "MNXT2ZM/A",
      "seller": "Name of the Seller"
    }
  ]
}'
{
  "id": "payment id, uuid format",
  "created_at": "2023-11-07T05:31:56Z",
  "expires_at": "2023-11-07T05:31:56Z",
  "status": "CLOSED",
  "is_test": true,
  "amount": "100",
  "currency": "AED",
  "description": "description",
  "buyer": {
    "name": "John Doe",
    "email": "jsmith@example.com",
    "phone": "500000001",
    "dob": "2000-01-20"
  },
  "shipping_address": {
    "city": "Dubai",
    "address": "Dubai",
    "zip": "1111"
  },
  "order": {
    "reference_id": "1001",
    "updated_at": "2023-11-07T05:31:56Z",
    "tax_amount": "0.00",
    "shipping_amount": "0.00",
    "discount_amount": "0.00",
    "items": [
      {
        "reference_id": "SKU123",
        "title": "Name of the product",
        "description": "Description of the product",
        "quantity": 1,
        "unit_price": "0.00",
        "image_url": "https://example.com/",
        "product_url": "https://example.com/",
        "gender": "Kids",
        "category": "Clothes",
        "color": "white",
        "product_material": "cotton",
        "size_type": "EU",
        "size": "M",
        "brand": "Name of the Brand",
        "is_refundable": true
      }
    ]
  },
  "captures": [
    {
      "id": "capture id, uuid format",
      "created_at": "2023-11-07T05:31:56Z",
      "amount": "100",
      "tax_amount": "0.00",
      "shipping_amount": "0.00",
      "discount_amount": "0.00",
      "items": [
        {
          "reference_id": "SKU123",
          "title": "Name of the product",
          "description": "Description of the product",
          "quantity": 1,
          "unit_price": "0.00",
          "image_url": "https://example.com/",
          "product_url": "https://example.com/",
          "gender": "Kids",
          "category": "Clothes",
          "color": "white",
          "product_material": "cotton",
          "size_type": "EU",
          "size": "M",
          "brand": "Name of the Brand",
          "is_refundable": true
        }
      ],
      "reference_id": "capture idempotency key"
    }
  ],
  "refunds": [
    {
      "id": "refund id, uuid format",
      "created_at": "2023-11-07T05:31:56Z",
      "amount": "0.00",
      "reason": "Reason for the refund",
      "items": [
        {
          "reference_id": "SKU123",
          "title": "Name of the product",
          "description": "Description of the product",
          "quantity": 1,
          "unit_price": "0.00",
          "image_url": "https://example.com/",
          "product_url": "https://example.com/",
          "gender": "Kids",
          "category": "Clothes",
          "color": "white",
          "product_material": "cotton",
          "size_type": "EU",
          "size": "M",
          "brand": "Name of the Brand",
          "is_refundable": true
        }
      ],
      "reference_id": "refund idempotency key"
    }
  ],
  "buyer_history": {
    "registered_since": "2023-11-07T05:31:56Z",
    "loyalty_level": 0,
    "wishlist_count": 0,
    "is_social_networks_connected": true,
    "is_phone_number_verified": true,
    "is_email_verified": true
  },
  "order_history": [
    {
      "purchased_at": "2023-11-07T05:31:56Z",
      "amount": "100",
      "payment_method": "card",
      "status": "new",
      "buyer": {
        "name": "John Doe",
        "email": "jsmith@example.com",
        "phone": "500000001",
        "dob": "2000-01-20"
      },
      "shipping_address": {
        "city": "Dubai",
        "address": "Dubai",
        "zip": "1111"
      },
      "items": [
        {
          "reference_id": "SKU123",
          "title": "Name of the product",
          "description": "Description of the product",
          "quantity": 1,
          "unit_price": "0.00",
          "image_url": "https://example.com/",
          "product_url": "https://example.com/",
          "gender": "Kids",
          "category": "Clothes",
          "color": "white",
          "product_material": "cotton",
          "size_type": "EU",
          "size": "M",
          "brand": "Name of the Brand",
          "is_refundable": true,
          "ordered": 0,
          "captured": 0,
          "shipped": 0,
          "refunded": 0
        }
      ]
    }
  ],
  "meta": {
    "customer": "#customer-id",
    "order_id": "#1234"
  },
  "attachment": {
    "body": "{\"flight_reservation_details\": {\"pnr\": \"TR9088999\",\"itinerary\": [...],\"insurance\": [...],\"passengers\": [...],\"affiliate_name\": \"some affiliate\"}}",
    "content_type": "application/vnd.tabby.v1+json"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <secret_key>, where <secret_key> is your secret_key.

Path Parameters

id
string<uuid>
required

ID of the payment.

Example:

"payment id, uuid format"

Body

application/json
amount
string
default:0.00
required

Amount refunded. Allows to send up to 2 decimals for AED and SAR, up to 3 decimals for KWD.

reference_id
string
required

Idempotency key. Used to avoid similar refund requests.

Example:

"refund idempotency key"

reason
string

Reason for the refund.

Example:

"Reason for the refund"

items
object[]

Array of objects representing the order items being refunded.

Response

Success. Payment object is returned.

Payment object.

amount
string
required

Total payment amount, including tax, shipping and any discounts. Allows to send up to 2 decimals for AED and SAR, up to 3 decimals for KWD.

Example:

"100"

currency
enum<string>
required

ISO 4217 currency code for the payment amount. Currently there are 3 possible currency options - depending on the country where the store is located:

  • AED - United Arab Emirates Dirham
  • SAR - Saudi Riyal
  • KWD - Kuwaiti Dinar
Available options:
AED,
SAR,
KWD
Example:

"AED"

buyer
object | null
required

Customer information

shipping_address
object | null
required
order
object | null
required
buyer_history
object
required

Customer information. registered_since (as a date of the customer's registration in the App), loyalty_level (as a number of successful orders) and wishlist_count (paid amount by a customer previously, e.g. 500) must be sent for Monthly Billing. is_social_networks_connected is also required for Monthly Billing.

order_history
object[] | null
required

Array of objects, should contain information on 5-10 previously placed via any payment method orders in any status, current order excluded.

id
string<uuid>

Unique identifier for the payment (UUID), assigned by Tabby. Save it on your side!

Example:

"payment id, uuid format"

created_at
string<date-time>

Date and time the payment was created, in UTC, and displayed in ISO 8601 datetime format.

expires_at
string<date-time>

Date and time the payment expires, in UTC, and displayed in ISO 8601 datetime format.

status
enum<string>

Status of the current payment:

  • CREATED means that the payment is created successfully, but not finished yet;
  • AUTHORIZED and CLOSED mark the successfully approved and captured payments accordingly;
  • REJECTED is returned when a customer is rejected during Tabby Checkout;
  • EXPIRED is used when a customer cancels a payment or when Tabby doesn't receive a successfully paid transaction after timeout.
Available options:
CREATED,
AUTHORIZED,
CLOSED,
REJECTED,
EXPIRED
Example:

"CLOSED"

is_test
boolean

Indicates whether this is a test payment (created using the Test API keys or Production API Keys).

description
string | null
Example:

"description"

captures
object[]
refunds
object[]
meta
object | null

Merchant-defined data about the payment. This field is a key-value map. The example properties provided below.

attachment
object | null

Extra data (booking info, insurance, flight reservations, ...) as serialized JSON