---
updatedAt: 2026-08-18T09:55:15.000Z
agentTools:
  projectIndex: https://docs.moneyhash.io/llms.txt
---

# Create loyalty earn

Creates a loyalty earn transaction for the account and queues processing with the configured provider. The transaction starts in PENDING status.

# OpenAPI definition

```json
{
  "openapi": "3.0.3",
  "info": {
    "title": "MoneyHash API",
    "version": "1.1.0",
    "description": "MoneyHash Public APIs documentation"
  },
  "paths": {
    "/api/v1.4/loyalty/earn/": {
      "post": {
        "operationId": "v1.1_loyalty_earn_create",
        "description": "Creates a loyalty earn transaction for the account and queues processing with the configured provider. The transaction starts in PENDING status.",
        "summary": "Create loyalty earn",
        "tags": [
          "v1.1"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEarnRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CreateEarnRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CreateEarnRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "AccessTokenAuth": []
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EarnCreateResponse"
                },
                "examples": {
                  "CreatedEarnTransaction": {
                    "value": {
                      "status": {
                        "code": 202,
                        "message": "success",
                        "errors": []
                      },
                      "data": {
                        "id": "550e8400-e29b-41d4-a716-446655440000",
                        "status": "PENDING",
                        "provider_id": "gwG0y8j",
                        "amount": "75.00",
                        "currency": "SAR",
                        "merchant_reference": "merchant-ref-1",
                        "created": "2026-05-13T12:00:00Z"
                      },
                      "count": 1,
                      "next": null,
                      "previous": null
                    },
                    "summary": "Created earn transaction",
                    "description": "Transaction accepted and async earn queued."
                  }
                }
              }
            },
            "description": ""
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocsErrorResponse400"
                },
                "examples": {
                  "UnsupportedCurrency": {
                    "value": {
                      "status": {
                        "code": 400,
                        "message": "",
                        "errors": [
                          {
                            "error": "Currency USD is not supported by this provider."
                          }
                        ]
                      },
                      "data": {},
                      "count": null,
                      "next": null,
                      "previous": null
                    },
                    "summary": "Unsupported currency"
                  }
                }
              }
            },
            "description": ""
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocsErrorResponse401"
                },
                "examples": {
                  "UnauthorizedAPIKey": {
                    "value": {
                      "status": {
                        "code": 401,
                        "message": "",
                        "errors": [
                          {
                            "detail": "Authentication credentials were not provided."
                          }
                        ]
                      },
                      "data": {},
                      "count": null,
                      "next": null,
                      "previous": null
                    },
                    "summary": "Unauthorized API key"
                  }
                }
              }
            },
            "description": ""
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CreateEarnRequest": {
        "type": "object",
        "properties": {
          "merchant_reference": {
            "type": "string",
            "description": "Your unique reference for this earn",
            "maxLength": 255
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "description": "Monetary amount driving the earn (provider rules apply)."
          },
          "currency": {
            "enum": [
              "USD",
              "CAD",
              "EUR",
              "AED",
              "AFN",
              "ALL",
              "AMD",
              "ARS",
              "AUD",
              "AZN",
              "BAM",
              "BDT",
              "BGN",
              "BHD",
              "BIF",
              "BND",
              "BOB",
              "BRL",
              "BWP",
              "BYN",
              "BZD",
              "CDF",
              "CHF",
              "CLP",
              "CNY",
              "COP",
              "CRC",
              "CVE",
              "CZK",
              "DJF",
              "DKK",
              "DOP",
              "DZD",
              "EEK",
              "EGP",
              "ERN",
              "ETB",
              "GBP",
              "GEL",
              "GHS",
              "GNF",
              "GTQ",
              "HKD",
              "HNL",
              "HRK",
              "HUF",
              "IDR",
              "ILS",
              "INR",
              "IQD",
              "IRR",
              "ISK",
              "JMD",
              "JOD",
              "JPY",
              "KES",
              "KHR",
              "KMF",
              "KRW",
              "KWD",
              "KZT",
              "LBP",
              "LKR",
              "LTL",
              "LVL",
              "LYD",
              "MAD",
              "MDL",
              "MGA",
              "MKD",
              "MMK",
              "MOP",
              "MUR",
              "MXN",
              "MYR",
              "MZN",
              "NAD",
              "NGN",
              "NIO",
              "NOK",
              "NPR",
              "NZD",
              "OMR",
              "PAB",
              "PEN",
              "PHP",
              "PKR",
              "PLN",
              "PYG",
              "QAR",
              "RON",
              "RSD",
              "RUB",
              "RWF",
              "SAR",
              "SDG",
              "SEK",
              "SGD",
              "SOS",
              "SYP",
              "THB",
              "TND",
              "TOP",
              "TRY",
              "TTD",
              "TWD",
              "TZS",
              "UAH",
              "UGX",
              "UYU",
              "UZS",
              "VEF",
              "VND",
              "XAF",
              "XOF",
              "YER",
              "ZAR",
              "ZMK",
              "ZWL",
              "MRU"
            ],
            "type": "string",
            "x-spec-enum-id": "926115c6927e9c0a",
            "description": "ISO currency code; must be supported by the loyalty provider.\n\n* `USD` - USD\n* `CAD` - CAD\n* `EUR` - EUR\n* `AED` - AED\n* `AFN` - AFN\n* `ALL` - ALL\n* `AMD` - AMD\n* `ARS` - ARS\n* `AUD` - AUD\n* `AZN` - AZN\n* `BAM` - BAM\n* `BDT` - BDT\n* `BGN` - BGN\n* `BHD` - BHD\n* `BIF` - BIF\n* `BND` - BND\n* `BOB` - BOB\n* `BRL` - BRL\n* `BWP` - BWP\n* `BYN` - BYN\n* `BZD` - BZD\n* `CDF` - CDF\n* `CHF` - CHF\n* `CLP` - CLP\n* `CNY` - CNY\n* `COP` - COP\n* `CRC` - CRC\n* `CVE` - CVE\n* `CZK` - CZK\n* `DJF` - DJF\n* `DKK` - DKK\n* `DOP` - DOP\n* `DZD` - DZD\n* `EEK` - EEK\n* `EGP` - EGP\n* `ERN` - ERN\n* `ETB` - ETB\n* `GBP` - GBP\n* `GEL` - GEL\n* `GHS` - GHS\n* `GNF` - GNF\n* `GTQ` - GTQ\n* `HKD` - HKD\n* `HNL` - HNL\n* `HRK` - HRK\n* `HUF` - HUF\n* `IDR` - IDR\n* `ILS` - ILS\n* `INR` - INR\n* `IQD` - IQD\n* `IRR` - IRR\n* `ISK` - ISK\n* `JMD` - JMD\n* `JOD` - JOD\n* `JPY` - JPY\n* `KES` - KES\n* `KHR` - KHR\n* `KMF` - KMF\n* `KRW` - KRW\n* `KWD` - KWD\n* `KZT` - KZT\n* `LBP` - LBP\n* `LKR` - LKR\n* `LTL` - LTL\n* `LVL` - LVL\n* `LYD` - LYD\n* `MAD` - MAD\n* `MDL` - MDL\n* `MGA` - MGA\n* `MKD` - MKD\n* `MMK` - MMK\n* `MOP` - MOP\n* `MUR` - MUR\n* `MXN` - MXN\n* `MYR` - MYR\n* `MZN` - MZN\n* `NAD` - NAD\n* `NGN` - NGN\n* `NIO` - NIO\n* `NOK` - NOK\n* `NPR` - NPR\n* `NZD` - NZD\n* `OMR` - OMR\n* `PAB` - PAB\n* `PEN` - PEN\n* `PHP` - PHP\n* `PKR` - PKR\n* `PLN` - PLN\n* `PYG` - PYG\n* `QAR` - QAR\n* `RON` - RON\n* `RSD` - RSD\n* `RUB` - RUB\n* `RWF` - RWF\n* `SAR` - SAR\n* `SDG` - SDG\n* `SEK` - SEK\n* `SGD` - SGD\n* `SOS` - SOS\n* `SYP` - SYP\n* `THB` - THB\n* `TND` - TND\n* `TOP` - TOP\n* `TRY` - TRY\n* `TTD` - TTD\n* `TWD` - TWD\n* `TZS` - TZS\n* `UAH` - UAH\n* `UGX` - UGX\n* `UYU` - UYU\n* `UZS` - UZS\n* `VEF` - VEF\n* `VND` - VND\n* `XAF` - XAF\n* `XOF` - XOF\n* `YER` - YER\n* `ZAR` - ZAR\n* `ZMK` - ZMK\n* `ZWL` - ZWL\n* `MRU` - MRU"
          },
          "webhook_url": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "description": "Optional HTTPS URL for loyalty earn callbacks."
          },
          "loyalty": {
            "allOf": [
              {
                "$ref": "#/components/schemas/LoyaltyDataInput"
              }
            ],
            "description": "Loyalty program and customer identifier for this earn."
          }
        },
        "required": [
          "amount",
          "currency",
          "loyalty",
          "merchant_reference"
        ]
      },
      "DocsErrorResponse400": {
        "type": "object",
        "properties": {
          "status": {
            "$ref": "#/components/schemas/DocsStatus"
          },
          "data": {
            "type": "object",
            "additionalProperties": {}
          },
          "count": {
            "type": "integer",
            "nullable": true,
            "description": "Total number of items."
          },
          "next": {
            "type": "string",
            "nullable": true,
            "description": "Next page url if exists"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "description": "Previous page url if exists"
          }
        },
        "required": [
          "count",
          "data",
          "next",
          "previous",
          "status"
        ]
      },
      "DocsErrorResponse401": {
        "type": "object",
        "properties": {
          "status": {
            "$ref": "#/components/schemas/DocsStatus"
          },
          "data": {
            "type": "object",
            "additionalProperties": {}
          },
          "count": {
            "type": "integer",
            "nullable": true,
            "description": "Total number of items."
          },
          "next": {
            "type": "string",
            "nullable": true,
            "description": "Next page url if exists"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "description": "Previous page url if exists"
          }
        },
        "required": [
          "count",
          "data",
          "next",
          "previous",
          "status"
        ]
      },
      "DocsStatus": {
        "type": "object",
        "properties": {
          "data": {
            "description": "Response message"
          }
        },
        "required": [
          "data"
        ]
      },
      "EarnCreateResponse": {
        "type": "object",
        "description": "Slim response shape for ``POST /loyalty/earn/`` (mirrors the spec).",
        "properties": {
          "id": {
            "type": "string",
            "description": "UUID is a unique identifier for the loyalty earn transaction."
          },
          "status": {
            "enum": [
              "PENDING",
              "EARNED",
              "PENDING_REVERSE",
              "REVERSE_FAILED",
              "REVERSED",
              "FAILED"
            ],
            "type": "string",
            "x-spec-enum-id": "6cf248feb958f547",
            "description": "Lifecycle state: pending earn, earned, reversal, terminal failure, etc.\n\n* `PENDING` - PENDING\n* `EARNED` - EARNED\n* `PENDING_REVERSE` - PENDING_REVERSE\n* `REVERSE_FAILED` - REVERSE_FAILED\n* `REVERSED` - REVERSED\n* `FAILED` - FAILED"
          },
          "provider_id": {
            "type": "string",
            "readOnly": true,
            "description": "MoneyHash loyalty service id (hashid)."
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "description": "Earn amount."
          },
          "currency": {
            "type": "string",
            "description": "ISO currency code of the earn amount."
          },
          "merchant_reference": {
            "type": "string",
            "description": "Merchant-supplied reference.",
            "maxLength": 255
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "amount",
          "created",
          "currency",
          "id",
          "merchant_reference",
          "provider_id"
        ]
      },
      "LoyaltyDataInput": {
        "type": "object",
        "properties": {
          "provider_id": {
            "type": "string",
            "description": "MoneyHash loyalty service id (hashid) connected to the account."
          },
          "identifier": {
            "type": "string",
            "description": "Customer identifier in the format required by identifier_type."
          },
          "identifier_type": {
            "enum": [
              "PHONE_NUMBER",
              "NATIONAL_ID",
              "EMAIL"
            ],
            "type": "string",
            "x-spec-enum-id": "3515c240a9887624",
            "description": "How to interpret identifier (for example PHONE_NUMBER, EMAIL, etc.).\n\n* `PHONE_NUMBER` - PHONE_NUMBER\n* `NATIONAL_ID` - NATIONAL_ID\n* `EMAIL` - EMAIL"
          }
        },
        "required": [
          "identifier",
          "identifier_type",
          "provider_id"
        ]
      }
    },
    "securitySchemes": {
      "AccessTokenAuth": {
        "type": "apiKey",
        "in": "query",
        "name": "access_token"
      },
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key"
      }
    }
  },
  "servers": [
    {
      "url": "https://web.moneyhash.io"
    }
  ],
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```