***

title: Run unreferenced refunds
published: true
---------------------

For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://docs.payroc.com/essentials-guides/payroc-cloud/extend-your-solution/llms.txt. For full documentation content, see https://docs.payroc.com/essentials-guides/payroc-cloud/extend-your-solution/llms-full.txt.

<Note>
  **Note:** To find out how to authorize your requests and handle errors, go to [Before You Begin](/guides/take-payments/payroc-cloud/extend-your-solution/extend.mdx#Before-you-begin).
</Note>

After you configure a device for Payroc Cloud, program your POS to use the Submit Refund Instruction method to send a refund instruction to the payment device.

To return funds to a cardholder, complete the following:

1. Submit a refund instruction to the device.
2. View the status of the refund instruction.
3. View the details of the refund instruction.

You can also cancel a refund instruction if it hasn’t yet completed.

## Step 1. Submit a refund instruction

To submit a refund instruction to a device, send a POST request to the Devices endpoint.

| Endpoint   | Prefix   | URL                                                                                                                                                    |
| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Test       | api.uat. | [https://api.uat.payroc.com/v1/devices/\{serialNumber}/refund-instructions](https://api.uat.payroc.com/v1/devices/\{serialNumber}/refund-instructions) |
| Production | api.     | [https://api.payroc.com/v1/devices/\{serialNumber}/refund-instructions](https://api.payroc.com/v1/devices/\{serialNumber}/refund-instructions)         |

### Request parameters

To create the body of your request, use the following parameters:

<EndpointSchemaSnippet endpoint="POST /devices/{serialNumber}/refund-instructions" selector="request.body" />

#### Example request

<EndpointRequestSnippet endpoint="POST /devices/{serialNumber}/refund-instructions" />

### Response fields

If your request is successful, we send the refund instruction to the device.

<Note>
  **Note:** The response returns a value of inProgress for the status field and an identifier for the instruction that you can use to check the status of the instruction. To get a link to view the details of the refund, go to Step 2.
</Note>

<EndpointSchemaSnippet endpoint="POST /devices/{serialNumber}/refund-instructions" selector="response.body" />

#### Example response

<EndpointResponseSnippet endpoint="POST /devices/{serialNumber}/refund-instructions" example="refundInstruction" />

## Step 2. View the status of a refund instruction

To check for updates to the status of the refund instruction, send a GET request to the Refund Instructions endpoint.

| Endpoint   | Prefix   | URL                                                                                                                                                  |
| ---------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| Test       | api.uat. | [https://api.uat.payroc.com/v1/refund-instructions/\{refundInstructionId}](https://api.uat.payroc.com/v1/refund-instructions/\{refundInstructionId}) |
| Production | api.     | [https://api.payroc.com/v1/refund-instructions/\{refundInstructionId}](https://api.payroc.com/v1/refund-instructions/\{refundInstructionId})         |

Before our gateway sends a response, it waits for up to a minute for the status of the instruction to change. We recommend that you keep the session open until the status of the instruction changes or the request times out.

If the status of the instruction doesn’t change, send another GET request. Our gateway waits up to a minute for the status of the instruction to change. Continue to send GET requests until the status changes.

<Note>
  **Note:** Wait until you receive a response from our gateway before you send another request.
</Note>

### Request parameters

To create your request, use the following parameters:

<EndpointSchemaSnippet endpoint="GET /refund-instructions/{refundInstructionId}" selector="request.path" />

#### Example request

<EndpointRequestSnippet endpoint="GET /refund-instructions/{refundInstructionId}" />

### Response fields

If your request is successful, we return the details of the refund instruction, including HATEOAS links to check the details of the refund. Use the HATEOAS links to get the refundId, which you need in Step 3.

If the status of the refund instruction is inProgress, our gateway waits up to a minute for the status to change before it returns a response.

<EndpointSchemaSnippet endpoint="GET /refund-instructions/{refundInstructionId}" selector="response.body" />

#### Example response

<EndpointResponseSnippet endpoint="GET /refund-instructions/{refundInstructionId}" example="Retrieved" />

## Step 3. View the details of the refund

To check whether the processor approved or declined the refund, send a GET request to the Refunds endpoint.

| Endpoint   | Prefix   | URL                                                                                                    |
| ---------- | -------- | ------------------------------------------------------------------------------------------------------ |
| Test       | api.uat. | [https://api.uat.payroc.com/v1/refunds/\{refundId}](https://api.uat.payroc.com/v1/refunds/\{refundId}) |
| Production | api.     | [https://api.payroc.com/v1/refunds/\{refundId}](https://api.payroc.com/v1/refunds/\{refundId})         |

### Request parameters

To create your request, use the following parameters:

<EndpointSchemaSnippet endpoint="GET /refunds/{refundId}" selector="request.path" />

#### Example request

<EndpointRequestSnippet endpoint="GET /refunds/{refundId}" />

### Response fields

If your request is successful, we return the details of the refund.

<EndpointSchemaSnippet endpoint="GET /refunds/{refundId}" selector="response.body" />

#### Example response

<EndpointResponseSnippet endpoint="GET /refunds/{refundId}" example="Retrieved" />

## (Optional) Cancel a refund instruction

To cancel a refund instruction, send a DELETE request to the Refund Instructions endpoint.

| Endpoint   | Prefix   | URL                                                                                                                                                  |
| ---------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| Test       | api.uat. | [https://api.uat.payroc.com/v1/refund-instructions/\{refundInstructionId}](https://api.uat.payroc.com/v1/refund-instructions/\{refundInstructionId}) |
| Production | api.     | [https://api.payroc.com/v1/refund-instructions/\{refundInstructionId}](https://api.payroc.com/v1/refund-instructions/\{refundInstructionId})         |

<Note>
  **Note:** You can cancel a refund instruction only if its status is `inProgress`.
</Note>

### Request parameters

To create your request, use the following parameters:

<EndpointSchemaSnippet endpoint="DELETE /refund-instructions/{refundInstructionId}" selector="request.path" />

#### Example request

<EndpointSchemaSnippet endpoint="DELETE /refund-instructions/{refundInstructionId}" />

### Response fields

If your request is successful, we cancel the refund instruction.