---
updatedAt: 2025-09-23T23:34:35.000Z
agentTools:
  projectIndex: https://docs.creditkey.com/v1.2/llms.txt
---

# /order/{key}/refund

Refund a full or partial amount of an order. A date can be provided to back-dated the refund.

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "paths": {
    "/order/{key}/refund": {
      "post": {
        "operationId": "OrderController_refund",
        "summary": "",
        "description": "Refund a full or partial amount of an order. A date can be provided to back-dated the refund.",
        "parameters": [
          {
            "name": "key",
            "required": true,
            "in": "path",
            "description": "The unique order key generated by Credit Key.",
            "example": "CK-GSB1288",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RefundOrderDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderEntity"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "example": [
                        "amount must not be less than 0.01"
                      ]
                    },
                    "error": {
                      "type": "string",
                      "example": "Bad Request"
                    },
                    "status_code": {
                      "type": "number",
                      "example": 400
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedException"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ForbiddenException"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundException"
                }
              }
            }
          }
        },
        "tags": [
          "Orders"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    }
  },
  "info": {
    "title": "Credit Key API Integration",
    "description": "An interface to interact with Credit Key for applications, orders, accounts, payments etc.",
    "version": "1.0",
    "contact": {}
  },
  "servers": [],
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "type": "http"
      }
    },
    "schemas": {
      "UnauthorizedException": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "example": "You don't have permission to access this resource"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          },
          "status_code": {
            "type": "number",
            "example": 401
          }
        }
      },
      "ForbiddenException": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "example": "Forbidden resource"
          },
          "error": {
            "type": "string",
            "example": "Forbidden"
          },
          "status_code": {
            "type": "number",
            "example": 403
          }
        }
      },
      "PaymentScheduleEntity": {
        "type": "object",
        "properties": {
          "installment": {
            "type": "number",
            "description": "The installment schedule number.",
            "example": 1
          },
          "date": {
            "type": "string",
            "description": "The installment due date.",
            "example": "2023-11-19"
          },
          "amount": {
            "type": "number",
            "description": "The total amount for this installment in USD.",
            "example": 70.46
          },
          "principal_amount": {
            "type": "number",
            "description": "The principal amount for this installment in USD.",
            "example": 61.5
          },
          "interest_amount": {
            "type": "number",
            "description": "The interest amount for this installment in USD.",
            "example": 8.96
          },
          "fee_amount": {
            "type": "number",
            "description": "The fee amount for this installment in USD.",
            "example": 0
          }
        }
      },
      "TermEntity": {
        "type": "object",
        "properties": {
          "installments": {
            "type": "number",
            "description": "The total number of monthly installments for this loan.",
            "example": 3
          },
          "interest_rate": {
            "type": "number",
            "description": "The interest rate for loans with this number of installments.",
            "example": 1.25
          },
          "monthly_payment": {
            "type": "number",
            "description": "The monthly payment amount of each installment in USD.",
            "example": 349.97
          },
          "total_fees": {
            "type": "number",
            "description": "The total fees amount for this loan in USD.",
            "example": 49.9
          },
          "total_fees_percent": {
            "type": "number",
            "description": "The total fees as a percentage for this loan.",
            "example": 4.99
          },
          "total_amount": {
            "type": "number",
            "description": "The total amount including all interest and fees for this loan in USD.",
            "example": 1049.9
          }
        }
      },
      "OrderEntity": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "The unique order key generated by Credit Key.",
            "example": "CK-GSB1288"
          },
          "company_id": {
            "type": "string",
            "description": "The ID of the company that has a credit application with Credit Key.",
            "example": "62544b69f777121c4dcbba42"
          },
          "merchant_order_id": {
            "type": "string",
            "description": "An optional unique order ID provided by merchants.",
            "example": ""
          },
          "installments": {
            "type": "number",
            "description": "The number of loan payment installments for this order.",
            "example": 1
          },
          "amount": {
            "type": "number",
            "description": "The total amount for this order in USD.",
            "example": 1000
          },
          "amount_refunded": {
            "type": "number",
            "description": "The total amount refunded for this order in USD.",
            "example": 0
          },
          "expected_repay_amount": {
            "type": "number",
            "description": "The total expected repayment amount including principal, interest and fees for this order in USD.",
            "example": 1178.78
          },
          "expected_fee_amount": {
            "type": "number",
            "description": "The total amount of interest and fees for this order in USD.",
            "example": 48.56
          },
          "expected_fee_percent": {
            "type": "number",
            "description": "The total amount of interest and fees as a percentage for this order.",
            "example": 4.99
          },
          "capture_date": {
            "type": "string",
            "description": "The expected date the order will be captured by the merchant. (Will be overridden by the actual loan disbursement date.)",
            "example": "2023-12-14"
          },
          "next_payment_date": {
            "type": "string",
            "description": "The date of the next expected order payment according to its loan schedule.",
            "example": "2023-11-19"
          },
          "payment_schedule": {
            "description": "The loan repayment schedule for this order.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentScheduleEntity"
            }
          },
          "externally_managed_payments": {
            "type": "boolean",
            "description": "If payments are to be handled externally by the merchant or internally by Credit Key.",
            "example": false
          },
          "created_at": {
            "type": "string",
            "description": "The date and time the order was created in UTC.",
            "example": "2023-01-01T15:10:00Z"
          },
          "status": {
            "enum": [
              "CREATED",
              "AUTHORIZED",
              "CANCELED",
              "CAPTURED",
              "RETURNED",
              "PENDING",
              "FAILED"
            ],
            "type": "string",
            "description": "The current status of the order.",
            "example": "CREATED"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "MAX_LOAN_AMOUNT_EXCEEDED",
                "CREDIT_BALANCE_NEGATIVE",
                "EXCEEDS_AVAILABLE_CREDIT",
                "EXCEEDS_XPL_LIMIT",
                "PAYMENT_AMOUNT_UNAFFORDABLE",
                "NOT_APPROVED",
                "COMPANY_ON_HOLD"
              ]
            },
            "description": "A list of reasons why the order has failed.",
            "example": []
          },
          "approved_terms": {
            "description": "List of all available payment terms for this order.",
            "example": [
              {
                "installments": 1,
                "interest_rate": 1,
                "monthly_payment": 1024.9,
                "total_fees": 24.9,
                "total_fees_percent": 2.49,
                "total_amount": 1024.9
              },
              {
                "installments": 2,
                "interest_rate": 1,
                "monthly_payment": 517.45,
                "total_fees": 34.9,
                "total_fees_percent": 3.49,
                "total_amount": 1034.9
              },
              {
                "installments": 3,
                "interest_rate": 1.25,
                "monthly_payment": 349.97,
                "total_fees": 49.9,
                "total_fees_percent": 4.99,
                "total_amount": 1049.9
              }
            ],
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TermEntity"
            }
          }
        }
      },
      "NotFoundException": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "example": "Resource not found"
          },
          "error": {
            "type": "string",
            "example": "Not Found"
          },
          "status_code": {
            "type": "number",
            "example": 404
          }
        }
      },
      "RefundOrderDto": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "number",
            "description": "The refund amount for this order in USD.",
            "example": 1000
          },
          "date": {
            "type": "string",
            "description": "The refund date. (Only relevant for back-dated refunds.)",
            "example": "2023-12-14"
          }
        },
        "required": [
          "amount"
        ]
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```