> For the complete documentation index, see [llms.txt](https://docs.payshield.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payshield.ai/transaction-processing/integrations-and-apis/rest-api/payment-refund.md). Agents can also search and read this documentation through its [MCP server](https://docs.payshield.ai/~gitbook/mcp).

# Payment Refund

## POST /{ptxid}/refund

> Initiates a refund for a specific transaction identified by the \`ptxid\` parameter. This endpoint allows partial or full refunds based on the provided input. Ensure the transaction ID (\`ptxid\`) corresponds to a valid transaction and has not been fully refunded previously.

```json
{"openapi":"3.0.0","info":{"title":"Txshield Api Version 1","version":"1.0"},"servers":[{"url":"/api/v1/index.php"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Personal API token of a user associated with the site. "}},"schemas":{"statusResponse":{"properties":{"tid":{"type":"string","description":"tid sent through with the transaction"},"txid":{"type":"integer","format":"int64","description":"Transaction id"},"parent_txid":{"type":"integer","format":"int64","description":"Each Transaction has a unique id. The parent transaction is the transaction that groups all transaction together."},"status":{"type":"string","description":"Has the value \"OK\" for a successful transaction, \"EXC\" for a failed transaction, \"PEND\" for a transaction in progress."},"tx_action":{"type":"string","description":"The state change txaction, e.g. \"PAYMENT\", \"REFUND\""},"amount":{"type":"number","description":"The amount of the transaction"},"currency":{"type":"string","description":"The currency of the transaction"},"reference":{"description":"Merchant reference","type":"string"},"ref1":{"type":"string","description":"your reference 1"},"ref2":{"type":"string","description":"your reference 2"},"ref3":{"type":"string","description":"your reference 3"},"ref4":{"type":"string","description":"your reference 4"},"vrfy":{"type":"string","description":"This is a sha256 hash so the data can be verified. Generate sha256 hash of the string of sid;rcode;txid;status;amount;currency;txaction"}}},"errorModel":{"required":["code","message"],"properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}},"paths":{"/{ptxid}/refund":{"post":{"description":"Initiates a refund for a specific transaction identified by the `ptxid` parameter. This endpoint allows partial or full refunds based on the provided input. Ensure the transaction ID (`ptxid`) corresponds to a valid transaction and has not been fully refunded previously.","parameters":[{"name":"ptxid","in":"path","description":"Parent txid of the transaction","required":true,"schema":{"type":"string"}},{"name":"sid","in":"query","description":"sid of site","required":true,"schema":{"type":"integer"}},{"name":"hash","in":"query","description":"sha256 hash of sid+timestamp+amount+currency+rcode e.g. hash('sha256', '22'.'1234568995265421'.'17.00'.'USD'.'222b6c')","required":true,"schema":{"type":"string"}},{"name":"timestamp","in":"query","description":"timestamp value used in the hash e.g. 1234568995265421","required":true,"schema":{"type":"string"}},{"name":"amount","in":"query","description":"Specifies the amount to refund for the transaction. This parameter is required and must be a string representing a numeric value (e.g., \"50.00\"). Use this to process a partial refund by providing a specific amount or the full transaction amount for a complete refund.","required":true,"schema":{"type":"string"}},{"name":"currency","in":"query","description":"Transaction currency, ISO 3 letter code (e.g., \"USD\")","required":true,"schema":{"type":"string"}},{"name":"reason","in":"query","description":"Provides a reason for the refund. This parameter is optional and can include a brief message explaining the refund request (e.g., \"Client Requested\" or \"Merchant Request\").","required":false,"schema":{"type":"string"}},{"name":"postbackurl","in":"query","description":"url to which a postback should be sent","required":false,"schema":{"type":"string"}},{"name":"sendNotification","in":"query","description":"Specifies whether to send a notification email related to the transaction. Set to `true` to enable email notifications or `false` to disable them.","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Lookup result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/statusResponse"}}}},"default":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorModel"}}}}}}}}}
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.payshield.ai/transaction-processing/integrations-and-apis/rest-api/payment-refund.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
