---
updatedAt: 2025-10-23T05:33:38.000Z
---

# Refund Commit - Headers

```json JSON
curl --request PUT \
     --url https://sandboxapi.moneygram.com/refund/v2/transactions/b607f42a-66ef-4dcd-9972-699957e326d4/commit \
     --header 'X-MG-ClientRequestId: 4c79b06f-a2af-4859-82c8-28cbb0bf361b' \
     --header 'accept: application/json' \
     --header 'authorization: Bearer 9xfw3iFQ9IjmuNHeAVDahXq1AYIF' \
     --header 'content-type: application/json' \
     --data '
{
  "targetAudience": "AGENT_FACING",
  "agentPartnerId": 30150519,
  "refundId": "301505191E17419893341677325779"
}
'
```

```node Node
import moneygramDeveloper from '@api/moneygram-developer';

moneygramDeveloper.auth('9xfw3iFQ9IjmuNHeAVDahXq1AYIF');
moneygramDeveloper.createOrUpdateTransactionRequest({
  targetAudience: 'AGENT_FACING',
  agentPartnerId: 30150519,
  refundId: '301505191E17419893341677325779'
}, {
  transactionId: 'b607f42a-66ef-4dcd-9972-699957e326d4',
  'X-MG-ClientRequestId': '4c79b06f-a2af-4859-82c8-28cbb0bf361b'
})
  .then(({ data }) => console.log(data))
  .catch(err => console.error(err));
```

```python Python
import requests

url = "https://sandboxapi.moneygram.com/refund/v2/transactions/b607f42a-66ef-4dcd-9972-699957e326d4/commit"

payload = {
    "targetAudience": "AGENT_FACING",
    "agentPartnerId": 30150519,
    "refundId": "301505191E17419893341677325779"
}
headers = {
    "accept": "application/json",
    "X-MG-ClientRequestId": "4c79b06f-a2af-4859-82c8-28cbb0bf361b",
    "content-type": "application/json",
    "authorization": "Bearer 9xfw3iFQ9IjmuNHeAVDahXq1AYIF"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
```

```java Java
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"targetAudience\":\"AGENT_FACING\",\"agentPartnerId\":30150519,\"refundId\":\"301505191E17419893341677325779\"}");
Request request = new Request.Builder()
  .url("https://sandboxapi.moneygram.com/refund/v2/transactions/b607f42a-66ef-4dcd-9972-699957e326d4/commit")
  .put(body)
  .addHeader("accept", "application/json")
  .addHeader("X-MG-ClientRequestId", "4c79b06f-a2af-4859-82c8-28cbb0bf361b")
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Bearer 9xfw3iFQ9IjmuNHeAVDahXq1AYIF")
  .build();

Response response = client.newCall(request).execute();
```

```json Response Example
{
  "referenceNumber": "94875952",
  "expectedPayoutDate": "2025-03-14",
}
```

# Prepare Headers & transactionID

<!-- json@2-7 -->
<!-- node@3,10 -->
<!-- python@10-15 -->
<!-- java@8-11 -->

The application must call the <a href="https://developer.moneygram.com/moneygram-developer/reference/createorupdatetransactionrequest" target="_blank">Commit a Transaction</a> endpoint with a PUT HTTP method, providing the OAuth access_token.

**Required Path Parameter**

<ul>
<li><code>transactionId</code></li>
</ul>

MoneyGram uses the OAuth 2.0 framework. The application must use their OAuth client credentials to generate an `access_token` by calling the [Get Access Token](https://developer.moneygram.com/moneygram-developer/reference/getaccesstoken) endpoint. The token is valid for 1 hour and must be passed as a header value in all subsequent API HTTP calls. [Learn More](https://developer.moneygram.com/moneygram-developer/docs/o-auth-api)

# Bearer Token

<!-- json@5 -->
<!-- node@3 -->
<!-- python@14 -->
<!-- java@11 -->

> - MoneyGram uses the OAuth 2.0 framework. The application must use their OAuth client credentials to generate an `access_token` by calling the [Get Access Token](https://developer.moneygram.com/moneygram-developer/reference/getaccesstoken) endpoint. The token is valid for 1 hour and must be passed as a header value in all subsequent API HTTP calls. [Learn More](https://developer.moneygram.com/moneygram-developer/docs/o-auth-api)