> ## Documentation Index
> Fetch the complete documentation index at: https://developers.stellar.org/llms.txt
> Use this file to discover all available pages before exploring further.

# do_stellar_refund

> <RpcMethod

`SEP-6` `SEP-24` `SEP-31`

Submits a refund payment to the Stellar network by a custody service

## Params (3)

> [!TIP]
>
> Please note that parameter structure within the request must contain named parameters as a by-name object, and not as positional arguments in a by-position array

**transaction\_id** `string` *required*

The unique identifier of this transaction.

A unique transaction identifier.

**message** `string`

Human readable explanation of transaction status.

A human readable message.

**refund** `object`

An object describing refund associated with this transaction.

**properties**

**amount** `object` *required*

Amount to be refunded

**properties**

**amount** `string` *required*

Amount of assets to refund

**asset** `string` *required*

The asset of refund

**amount\_fee** `object` *required*

Amount of fee

**properties**

**amount** `string` *required*

The amount of fee

**asset** `string` *required*

The asset of fee charged by anchor

## Result

*(do\_stellar\_refundResponse)*

**id** `string`

A unique transaction identifier.

**sep** `integer`

Protocol of the transaction.

Available options: `6`, `24`, `31`

**kind** `string`

The kind of transaction that is desired.

Available options: `undefined`, `receive`, `deposit`, `deposit-exchange`, `withdrawal`, `withdrawal-exchange`

**status** `string`

Processing status of the transaction.

Available options: `pending_anchor`, `pending_trust`, `pending_user`, `pending_user_transfer_start`, `pending_user_transfer_complete`, `incomplete`, `no_market`, `too_small`, `too_large`, `pending_sender`, `pending_receiver`, `pending_transaction_info_update`, `pending_customer_info_update`, `completed`, `refunded`, `expired`, `error`, `pending_external`, `pending_stellar`

**amount\_expected** `object`

The amount expected in the payment.

**properties**

**amount** `string`

A stringified amount of an asset.

**asset** `string`

An asset.

**amount\_in** `object`

Amount expected/received by anchor.

**properties**

**amount** `string`

A stringified amount of an asset.

**asset** `string`

An asset.

**amount\_out** `object`

The amount expected to be sent by anchor to user at end of transaction.

**properties**

**amount** `string`

A stringified amount of an asset.

**asset** `string`

An asset.

**fee\_details** `object`

Description of fee charged by the anchor.

**properties**

**total** `number` *required*

**asset** `string` *required*

**details** `object[]`

Details about fee charged.

**items**

**name** `string`

**description** `string`

**amount** `number`

**quote\_id** `string`

The id returned from a SEP-38 POST /quote response

**started\_at** `string`

Start date and time of transaction.

**updated\_at** `string`

The date and time of transaction reaching the current status.

**completed\_at** `string`

The date and time of transaction reaching completed or refunded status.

**transfer\_received\_at** `string`

The date and time of receiving transfer.

**message** `string`

Human readable explanation of transaction status

**refunds** `object`

An object describing any on or offchain refund associated with this transaction.

**properties**

**amount\_refunded** `object`

The total amount refunded in units of amount\_in\_asset.

**properties**

**amount** `string`

A numerical representation of an amount of some asset.

**asset** `string`

An asset.

**amount\_fee** `object`

The total amount charged in fees for processing all refund payments, in units of amount\_in\_asset.

**properties**

**amount** `string`

A numerical representation of an amount of some asset.

**asset** `string`

An asset.

**payments** `object[]`

A list of objects containing information on the individual payments made back as refunds.

**items**

**id** `string`

The Stellar transaction hash.

**id\_type** `string`

**amount** `object`

The amount sent back for the payment identified by id, in units of amount\_in\_asset.

**properties**

**amount** `string`

A numerical representation of an amount of some asset.

**asset** `string`

An asset.

**fee** `object`

The amount charged as a fee for processing the refund, in units of amount\_in\_asset.

**properties**

**amount** `string`

A numerical representation of an amount of some asset.

**asset** `string`

An asset.

**requested\_at** `string`

The date and time of requesting refund.

**refunded\_at** `string`

The date and time of making refund.

## Example

Example request to the `do_stellar_refund` method.

**Request**

```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
  "jsonrpc": "2.0",
  "id": 8675309,
  "method": "do_stellar_refund",
  "params": {
    "transaction_id": "1c186184-09ee-486c-82a7-aa7a0ab1119d",
    "message": "Do Stellar refund",
    "refund": {
      "amount": {
        "amount": 1,
        "asset": "stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
      },
      "amount_fee": {
        "amount": 0.1,
        "asset": "stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
      }
    }
  }
}' \
https://platform-server.exampleanchor.com | jq
```

```js JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
let requestBody = {
  jsonrpc: "2.0",
  id: 8675309,
  method: "do_stellar_refund",
  params: {
    transaction_id: "1c186184-09ee-486c-82a7-aa7a0ab1119d",
    message: "Do Stellar refund",
    refund: {
      amount: {
        amount: 1,
        asset:
          "stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
      },
      amount_fee: {
        amount: 0.1,
        asset:
          "stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
      },
    },
  },
};
let res = await fetch("https://platform-server.exampleanchor.com", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify(requestBody),
});
let json = await res.json();
console.log(json);
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import json, requests
res = requests.post("https://platform-server.exampleanchor.com", json={
    "jsonrpc": "2.0",
    "id": 8675309,
    "method": "do_stellar_refund",
    "params": {
        "transaction_id": "1c186184-09ee-486c-82a7-aa7a0ab1119d",
        "message": "Do Stellar refund",
        "refund": {
            "amount": {
                "amount": 1,
                "asset": "stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
            },
            "amount_fee": {
                "amount": 0.1,
                "asset": "stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
            }
        }
    }
})
print(json.dumps(res.json(), indent=4))
```

```json JSON theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "jsonrpc": "2.0",
  "id": 8675309,
  "method": "do_stellar_refund",
  "params": {
    "transaction_id": "1c186184-09ee-486c-82a7-aa7a0ab1119d",
    "message": "Do Stellar refund",
    "refund": {
      "amount": {
        "amount": 1,
        "asset": "stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
      },
      "amount_fee": {
        "amount": 0.1,
        "asset": "stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
      }
    }
  }
}
```

**Result**

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "jsonrpc": "2.0",
  "id": 8675309,
  "result": {
    "id": "1c186184-09ee-486c-82a7-aa7a0ab1119d",
    "sep": "24",
    "kind": "deposit",
    "status": "completed",
    "amount_expected": {
      "amount": "1",
      "asset": "stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
    },
    "amount_in": {
      "amount": "1",
      "asset": "stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
    },
    "amount_out": {
      "amount": "0.9",
      "asset": "iso4217:USD"
    },
    "fee_details": {
      "total": "0.1",
      "asset": "stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
    },
    "started_at": "2023-08-04T10:04:06.280923Z",
    "updated_at": "2023-08-04T10:04:15.716233Z",
    "message": "Transaction complete",
    "source_account": "GB4GJAV4Q7DPGU7WI3H5TMVKEYZJ4JFLFEF3O3TRJKDPXK7NAMRBXWFL",
    "destination_account": "GDIN5ZULIOT5YPBIXJXFGNH4TCNTDKIA4ZF6QQE3S2P5P44BHCQQJNDC"
  }
}
```
