---
updatedAt: 2026-04-20T20:05:35.000Z
agentTools:
  projectIndex: https://docs.neonpay.com/llms.txt
---

# Refunds a purchase.


Refunds are typically handled by Neon. Please reach out to Neon to determine if you qualify for access to this API.


# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Purchase API",
    "description": "The Purchase API can be used to get details about a purchase, refund purchases, and subscribe to purchase-related webhooks. Purchases are created when the user successfully completes a checkout. Once finalized, a checkout can no longer be accessed or modified; instead, use the purchase API to find the associated checkout.\n",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.neonpay.com"
    }
  ],
  "security": [
    {
      "EnvironmentApiKey": []
    }
  ],
  "paths": {
    "/purchases/{purchaseId}/refund": {
      "post": {
        "summary": "Refunds a purchase.\n",
        "description": "Refunds are typically handled by Neon. Please reach out to Neon to determine if you qualify for access to this API.\n",
        "operationId": "refundPurchase",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "in": "path",
            "name": "purchaseId",
            "description": "A valid purchase ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/RefundToOriginalPaymentMethod"
                  },
                  {
                    "$ref": "#/components/schemas/RefundToWallet"
                  },
                  {
                    "$ref": "#/components/schemas/PartialRefundToOriginalPaymentMethod"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Refund Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Refund"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/PurchaseNotFoundError"
          },
          "409": {
            "description": "The purchase can't be refunded in its current state (e.g. it has an unresolved dispute, another refund is already in progress, its wallet is closed, it has already been refunded to a wallet, or a wallet refund was requested but wallets aren't configured for the purchase's country)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIError"
                }
              }
            }
          },
          "422": {
            "description": "Partial refunds and positive refund fees are not supported for purchases involving wallet funds or associated cashback.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIError"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PurchasePayment": {
        "type": "object",
        "description": "A payment method and its associated amount.",
        "required": [
          "method",
          "amount"
        ],
        "properties": {
          "method": {
            "$ref": "#/components/schemas/PaymentMethod"
          },
          "amount": {
            "type": "integer",
            "description": "The amount associated with this method, expressed as 100x the currency's base unit, in the purchase or refund's currency.\n"
          }
        }
      },
      "PaymentMethod": {
        "type": "string",
        "enum": [
          "credit_card",
          "debit_card",
          "prepaid_card",
          "unknown_card",
          "apple_pay",
          "google_pay",
          "sepa",
          "paypal",
          "pix",
          "naver_pay",
          "kakao_pay",
          "toss",
          "line_pay",
          "modo",
          "ovo",
          "oxxo",
          "boleto",
          "mercado_pago",
          "dana",
          "grabpay",
          "paysafecard",
          "upi",
          "net_banking",
          "wechat_pay",
          "alipay",
          "ideal",
          "bancontact",
          "przelewy24",
          "eps",
          "samsung_pay",
          "blik",
          "cash_app_pay",
          "klarna",
          "venmo",
          "bank_transfer_pk",
          "easypaisa",
          "jazzcash",
          "spei",
          "pagoefectivo",
          "yape",
          "picpay",
          "neon_wallet",
          "pix_automatico",
          "stripe_south_korea_market"
        ]
      },
      "Refund": {
        "type": "object",
        "required": [
          "purchaseId",
          "id",
          "refundId",
          "date",
          "subtotalAmount",
          "taxAmount",
          "totalAmount",
          "playerCountry",
          "initialCurrency",
          "initialPlayerCountry",
          "pricingSheetName",
          "items",
          "payment",
          "payments",
          "destinations"
        ],
        "properties": {
          "purchaseId": {
            "description": "The ID of the purchase being refunded",
            "type": "string"
          },
          "id": {
            "description": "The refund ID",
            "type": "string"
          },
          "refundId": {
            "type": "string",
            "description": "The refund ID",
            "deprecated": true
          },
          "date": {
            "description": "The date of the refund",
            "type": "string",
            "format": "date-time"
          },
          "currency": {
            "description": "The currency of the refunded purchase",
            "type": "string"
          },
          "subtotalAmount": {
            "description": "**Deprecated:** Use `itemsSubtotalAmount` or `totalExcludingTaxAmount` instead. The refund subtotal (i.e., the amount passed in), expressed as 100x the currency's base unit; see [here](https://docs.neonpay.com/docs/currencies#currencies-in-the-api) for more on currencies",
            "type": "number",
            "deprecated": true
          },
          "taxAmount": {
            "description": "The amount of sales tax refunded, expressed as 100x the currency's base unit; see [here](https://docs.neonpay.com/docs/currencies#currencies-in-the-api) for more on currencies",
            "type": "number"
          },
          "totalAmount": {
            "description": "The total amount returned to the customer, expressed as 100x the currency's base unit; see [here](https://docs.neonpay.com/docs/currencies#currencies-in-the-api) for more on currencies",
            "type": "number"
          },
          "accountId": {
            "description": "A unique identifier for the player or account **in your system** who should receive the purchased items. Neon includes this value in fulfillment webhooks so you can credit the correct user.\n",
            "type": [
              "string",
              "null"
            ],
            "example": "player_987654",
            "minLength": 1
          },
          "externalReferenceId": {
            "description": "The developer-supplied external reference ID on the originating purchase, if available",
            "type": [
              "string",
              "null"
            ]
          },
          "externalMetadata": {},
          "playerCountry": {
            "type": [
              "string",
              "null"
            ],
            "description": "The player's ISO 3166-1 alpha-2 country",
            "example": "US"
          },
          "initialCurrency": {
            "type": "string",
            "description": "The initial currency of the checkout before any currency changes"
          },
          "initialPlayerCountry": {
            "type": "string",
            "description": "The initial player country of the checkout before any country changes"
          },
          "pricingSheetName": {
            "type": [
              "string",
              "null"
            ],
            "description": "The name of the pricing sheet used for this purchase"
          },
          "items": {
            "description": "The items in the original purchase",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RefundItem"
            }
          },
          "payment": {
            "type": [
              "object",
              "null"
            ],
            "deprecated": true,
            "description": "The payment details for this purchase. Deprecated: for a split payment this reflects only the payment processor leg. Use `payments` instead.\n",
            "required": [
              "vendor",
              "method"
            ],
            "properties": {
              "vendor": {
                "type": "string",
                "description": "The payment vendor used for this purchase"
              },
              "method": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The payment method used for this purchase, if available (e.g. free purchases)"
              }
            }
          },
          "payments": {
            "type": "array",
            "description": "Every payment that funded the original purchase. The amounts sum to the originating purchase's `totalAmount`.\n",
            "items": {
              "$ref": "#/components/schemas/PurchasePayment"
            }
          },
          "destinations": {
            "type": "array",
            "minItems": 1,
            "description": "The intended allocation of this refund. Amounts sent to the same method are aggregated, and the amounts sum to this refund's `totalAmount`.\n",
            "items": {
              "$ref": "#/components/schemas/RefundDestination"
            }
          }
        }
      },
      "RefundItem": {
        "type": "object",
        "required": [
          "id",
          "quantity",
          "item",
          "sku",
          "name",
          "price",
          "referencePrice",
          "referenceCurrency"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "The unique ID of this item",
            "deprecated": true
          },
          "quantity": {
            "type": "number",
            "description": "The number of units of this item refunded"
          },
          "item": {
            "type": "object",
            "description": "The original purchased item",
            "required": [
              "id",
              "sku"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "The unique ID of this item"
              },
              "sku": {
                "type": "string",
                "description": "The SKU of this item"
              }
            }
          },
          "sku": {
            "type": "string",
            "description": "The SKU of this item",
            "deprecated": true
          },
          "name": {
            "type": "string",
            "description": "The localized name of this item",
            "deprecated": true
          },
          "price": {
            "type": "number",
            "description": "The price of this item, expressed as 100x the smallest unit of the purchase currency",
            "deprecated": true
          },
          "refundableQuantity": {
            "type": "number",
            "description": "The purchased quantity of this item, excluding refunded units",
            "deprecated": true
          },
          "referencePrice": {
            "type": "number",
            "description": "The price of this item in the settlement currency",
            "deprecated": true
          },
          "referenceCurrency": {
            "type": "string",
            "description": "The settlement currency of this item",
            "deprecated": true
          }
        }
      },
      "RefundDestination": {
        "description": "A payment method receiving a refund and the amount sent to it.",
        "allOf": [
          {
            "$ref": "#/components/schemas/PurchasePayment"
          }
        ]
      },
      "APIError": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "The HTTP response code",
            "example": 400
          },
          "code": {
            "type": "string",
            "description": "An error code that is static and can be used for programmatic error handling",
            "example": "PURCHASE_NOT_FOUND"
          },
          "message": {
            "type": "string",
            "description": "A human readable description of the error",
            "example": "Purchase not found"
          },
          "errors": {
            "type": "array",
            "description": "A list of more detailed errors about specific errors for specific entities",
            "items": {
              "$ref": "#/components/schemas/ErrorDetail"
            }
          }
        }
      },
      "ErrorDetail": {
        "type": "object",
        "required": [
          "source",
          "message"
        ],
        "properties": {
          "source": {
            "type": "string",
            "description": "Specific entity that caused this error",
            "example": "purchaseId"
          },
          "message": {
            "type": "string",
            "description": "Human readable description of the error for this entity (defined in `source`)",
            "example": "Purchase not found"
          }
        }
      },
      "PurchaseNotFoundError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "example": "PURCHASE_NOT_FOUND",
                "enum": [
                  "PURCHASE_NOT_FOUND"
                ]
              },
              "message": {
                "type": "string",
                "example": "Purchase not found."
              }
            }
          }
        }
      },
      "RefundToOriginalPaymentMethod": {
        "type": "object",
        "additionalProperties": false,
        "description": "Refund the full purchase amount to the original payment method.",
        "properties": {
          "destination": {
            "type": "string",
            "enum": [
              "original_payment_method"
            ],
            "description": "Refund to the original payment method. This is the default when destination is omitted."
          },
          "fee": {
            "type": "number",
            "description": "The amount to be removed from the fee (treated as 0 if not provided), expressed as 100x the currency's base unit; see [here](https://docs.neonpay.com/docs/currencies#currencies-in-the-api) for more on currencies"
          },
          "wallet": {
            "type": "object",
            "additionalProperties": false,
            "description": "Metadata for the wallet reversals this refund makes when the purchase used the player's wallet or earned cashback.",
            "properties": {
              "holdReversalMetadata": {
                "$ref": "#/components/schemas/Metadata",
                "description": "Metadata to be saved to the HoldReversal as part of this refund"
              },
              "cashbackLotReversalMetadata": {
                "$ref": "#/components/schemas/Metadata",
                "description": "Metadata to be saved to the LotReversal as part of this refund to reverse any cashback granted"
              }
            }
          }
        }
      },
      "Metadata": {
        "type": [
          "object",
          "null"
        ],
        "propertyNames": {
          "$ref": "#/components/schemas/NonEmptyNulFreeString"
        },
        "additionalProperties": {
          "$ref": "#/components/schemas/NulFreeJsonValue"
        }
      },
      "NonEmptyNulFreeString": {
        "type": "string",
        "minLength": 1,
        "pattern": "^[^\\x00]*$"
      },
      "NulFreeJsonValue": {
        "if": {
          "type": "object"
        },
        "then": {
          "propertyNames": {
            "pattern": "^[^\\x00]*$"
          },
          "additionalProperties": {
            "$ref": "#/components/schemas/NulFreeJsonValue"
          }
        },
        "else": {
          "pattern": "^[^\\x00]*$",
          "items": {
            "$ref": "#/components/schemas/NulFreeJsonValue"
          }
        }
      },
      "RefundToWallet": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "destination",
          "wallet"
        ],
        "description": "Refund the full cash-paid portion to the player's wallet.",
        "properties": {
          "destination": {
            "type": "string",
            "enum": [
              "wallet"
            ],
            "description": "Refund the cash-paid portion to the player's wallet instead of the original payment method."
          },
          "wallet": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "expiryDays"
            ],
            "properties": {
              "incentive": {
                "$ref": "#/components/schemas/RefundIncentive"
              },
              "expiryDays": {
                "type": "integer",
                "minimum": 1,
                "maximum": 36500,
                "description": "Number of days the refunded wallet funds remain valid, measured from the time the refund is processed."
              },
              "refundToWalletLotMetadata": {
                "$ref": "#/components/schemas/Metadata",
                "description": "Metadata to be saved to the refund_credit Lot created if refund-to-wallet is selected"
              },
              "holdReversalMetadata": {
                "$ref": "#/components/schemas/Metadata",
                "description": "Metadata to be saved to the HoldReversal as part of this refund"
              },
              "cashbackLotReversalMetadata": {
                "$ref": "#/components/schemas/Metadata",
                "description": "Metadata to be saved to the LotReversal as part of this refund to reverse any cashback granted"
              }
            }
          }
        }
      },
      "RefundIncentive": {
        "description": "Optionally grant the user additional funds when refunding to wallet. Granted as a separate `free_promo` lot, which expires at the same time as the refunded credit — `wallet.expiryDays` after the refund is processed. `percentage` is multiplied against the tax-inclusive, cash-paid portion of the purchase, rather than the value of the entire purchase.\n",
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "percentage"
            ],
            "properties": {
              "percentage": {
                "type": "string",
                "pattern": "^((0|[1-9][0-9]?)(\\.[0-9]{1,10})?|100(\\.0{1,10})?)$",
                "description": "A percentage greater than 0 and at most 100. The resulting amount is rounded up to two decimal places of the currency's base unit. For example, \"10.5\" means 10.5% and grants an additional KRW 1,050 when the tax-inclusive, cash-paid portion is KRW 10,000.\n",
                "example": "10.5"
              },
              "incentiveLotMetadata": {
                "$ref": "#/components/schemas/Metadata",
                "description": "Metadata to be saved to the free_promo Lot grant created if refund-to-wallet is selected"
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "amount"
            ],
            "properties": {
              "amount": {
                "type": "integer",
                "minimum": 1,
                "maximum": 2147483647,
                "description": "A fixed amount in the purchase currency, expressed as 100x its base unit; see [here](https://docs.neonpay.com/docs/currencies#currencies-in-the-api) for more on currencies. The purchase's currency must be the one the player's wallet holds, and the amount must be a whole practical minor unit.\n",
                "example": 500
              },
              "incentiveLotMetadata": {
                "$ref": "#/components/schemas/Metadata",
                "description": "Metadata to be saved to the free_promo Lot grant created if refund-to-wallet is selected"
              }
            }
          }
        ]
      },
      "PartialRefundToOriginalPaymentMethod": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items"
        ],
        "description": "Refund selected item quantities to the original payment method.",
        "properties": {
          "destination": {
            "type": "string",
            "enum": [
              "original_payment_method"
            ],
            "description": "Refund to the original payment method. This is the default when destination is omitted; partial refunds to a wallet are not supported."
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "itemId",
                "quantity"
              ],
              "properties": {
                "itemId": {
                  "type": "string",
                  "description": "The ID of the purchased item to be refunded"
                },
                "quantity": {
                  "type": "number",
                  "description": "The number of units of this item to be refunded; units are refunded in order of most to least discounted"
                }
              }
            }
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Response for bad requests. Should note what in the request was invalid.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/APIError"
            }
          }
        }
      },
      "PurchaseNotFoundError": {
        "description": "Purchase is not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PurchaseNotFoundError"
            }
          }
        }
      },
      "InternalServerError": {
        "description": "An unexpected server error.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/APIError"
            }
          }
        }
      },
      "ServiceUnavailable": {
        "description": "The service is temporarily unavailable. Retry later.",
        "headers": {
          "Retry-After": {
            "description": "If present, the number of seconds to wait before you retry.",
            "schema": {
              "type": "integer"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/APIError"
            }
          }
        }
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Makes the request safe to retry. 1-255 visible ASCII characters, for example a UUID. See [Idempotent requests](https://docs.neonpay.com/docs/idempotent-requests).\n",
        "schema": {
          "type": "string"
        }
      }
    },
    "securitySchemes": {
      "EnvironmentApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "Your Environment API key, scoped to a particular environment. Sandbox keys are prefixed with `pk_sandbox_`;\nproduction keys are prefixed with `pk_`. Find your keys in the Neon dashboard.\n"
      }
    }
  }
}
```