> For the complete documentation index, see [llms.txt](https://doc.ecomm.api.tietoevry.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.ecomm.api.tietoevry.com/api-references/unified-merchant-api/refunds.md).

# Refunds

## Refund card or open banking payments

> Return the funds to the customer's bank.If refunding a payment that is not yet captured it will be cancelled

```json
{"openapi":"3.1.0","info":{"title":"E-commerce Gateway API","version":"1.0.0"},"servers":[{"url":"https://sandbox-api.ecomm.api.tietoevry.com"}],"security":[{"OAuth2ClientAuthentication":[]}],"components":{"securitySchemes":{"OAuth2ClientAuthentication":{"type":"openIdConnect","description":"This API uses OAuth 2 with the client credentials flow. [More info](https://www.rfc-editor.org/rfc/rfc6749#section-4.4)","openIdConnectUrl":"https://ecomm.api.tietoevry.com/auth/realms/participants-tietoevry/protocol/openid-connect/token"}},"schemas":{"RefundPaymentRequest":{"type":"object","description":"The request for refunding a payment","properties":{"instructedAmount":{"$ref":"#/components/schemas/Amount","description":"Amount to be refunded"},"paymentId":{"type":"string","description":"Unique ID of the payment","maxLength":64}},"required":["instructedAmount","paymentId"],"title":"Refund Payment Request"},"Amount":{"type":"object","properties":{"amount":{"type":"string","description":"The amount given with fractional digits, where fractions must be compliant to the currency definition.\nUp to 14 significant figures. The decimal separator is a dot.\nCan be 0 for account verification (save payment method for future usage without initial payment).\n\n**Example:**\nValid representations for EUR with up to two decimals are:\n  * 1056\n  * 5768.2\n  * 1.50\n  * 5877.78\n"},"currency":{"type":"object","description":"ISO 4217 alpha-3 currency code","properties":{"currencyCode":{"type":"string"},"defaultFractionDigits":{"type":"integer","format":"int32"},"displayName":{"type":"string"},"numericCode":{"type":"integer","format":"int32"},"numericCodeAsString":{"type":"string"},"symbol":{"type":"string"}}}},"required":["amount","currency"]},"RefundPaymentResponse":{"type":"object","description":"The response after refunding a card payment","properties":{"instructedAmount":{"$ref":"#/components/schemas/Amount","description":"Refunded amount"},"paymentId":{"type":"string","description":"Unique ID of the refunded payment","maxLength":64},"refundId":{"type":"string","description":"Unique ID of the refund","maxLength":64},"refundStatus":{"type":"string","description":"Current status of the refund","enum":["INITIALIZED","COMPLETED","FAILED","REVERTED"]}},"title":"Refund Payment Response"},"ErrorResponse":{"type":"object","properties":{"apiClientMessages":{"type":"array","items":{"$ref":"#/components/schemas/ApiClientMessage"}}}},"ApiClientMessage":{"type":"object","properties":{"category":{"type":"string","enum":["ERROR"]},"code":{"type":"string"},"text":{"type":"string"}}}}},"paths":{"/egw/{version}/refunds":{"post":{"description":"Return the funds to the customer's bank.If refunding a payment that is not yet captured it will be cancelled","operationId":"refundPayment","parameters":[{"description":"ID of the request, unique to the call, as determined by the initiating party","in":"header","name":"X-Request-Id","required":true,"schema":{"type":"string","format":"uuid","description":"ID of the request, unique to the call, as determined by the initiating party"}},{"in":"path","name":"version","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundPaymentRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundPaymentResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Conflict"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Service Unavailable"}},"summary":"Refund card or open banking payments","tags":["Refund API"]}}}}
```

## Revert refund for open banking payments

> If the refund turns out to be unsuccessful it can be revertedto align the payment status and amount with the real state

```json
{"openapi":"3.1.0","info":{"title":"E-commerce Gateway API","version":"1.0.0"},"servers":[{"url":"https://sandbox-api.ecomm.api.tietoevry.com"}],"security":[{"OAuth2ClientAuthentication":[]}],"components":{"securitySchemes":{"OAuth2ClientAuthentication":{"type":"openIdConnect","description":"This API uses OAuth 2 with the client credentials flow. [More info](https://www.rfc-editor.org/rfc/rfc6749#section-4.4)","openIdConnectUrl":"https://ecomm.api.tietoevry.com/auth/realms/participants-tietoevry/protocol/openid-connect/token"}},"schemas":{"RefundReversalResponse":{"type":"object","description":"The response after reversing a refund","properties":{"instructedAmount":{"$ref":"#/components/schemas/Amount","description":"Refunded amount"},"paymentId":{"type":"string","description":"Unique ID of the refunded payment","maxLength":64},"refundId":{"type":"string","description":"Unique ID of the refund","maxLength":64},"refundStatus":{"type":"string","description":"Current status of the refund","enum":["INITIALIZED","COMPLETED","FAILED","REVERTED"]}},"title":"Refund Reversal Response"},"Amount":{"type":"object","properties":{"amount":{"type":"string","description":"The amount given with fractional digits, where fractions must be compliant to the currency definition.\nUp to 14 significant figures. The decimal separator is a dot.\nCan be 0 for account verification (save payment method for future usage without initial payment).\n\n**Example:**\nValid representations for EUR with up to two decimals are:\n  * 1056\n  * 5768.2\n  * 1.50\n  * 5877.78\n"},"currency":{"type":"object","description":"ISO 4217 alpha-3 currency code","properties":{"currencyCode":{"type":"string"},"defaultFractionDigits":{"type":"integer","format":"int32"},"displayName":{"type":"string"},"numericCode":{"type":"integer","format":"int32"},"numericCodeAsString":{"type":"string"},"symbol":{"type":"string"}}}},"required":["amount","currency"]},"ErrorResponse":{"type":"object","properties":{"apiClientMessages":{"type":"array","items":{"$ref":"#/components/schemas/ApiClientMessage"}}}},"ApiClientMessage":{"type":"object","properties":{"category":{"type":"string","enum":["ERROR"]},"code":{"type":"string"},"text":{"type":"string"}}}}},"paths":{"/egw/{version}/refunds/{refundId}/revert":{"patch":{"description":"If the refund turns out to be unsuccessful it can be revertedto align the payment status and amount with the real state","operationId":"revertRefund","parameters":[{"description":"ID of the request, unique to the call, as determined by the initiating party","in":"header","name":"X-Request-Id","required":true,"schema":{"type":"string","format":"uuid","description":"ID of the request, unique to the call, as determined by the initiating party"}},{"description":"Unique ID of the refund","in":"path","name":"refundId","required":true,"schema":{"type":"string","description":"Unique ID of the refund","maxLength":64}},{"in":"path","name":"version","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundReversalResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Conflict"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Service Unavailable"}},"summary":"Revert refund for open banking payments","tags":["Refund API"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://doc.ecomm.api.tietoevry.com/api-references/unified-merchant-api/refunds.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
