Get Unique Refund
curl --request GET \
--url https://api.sandbox.wepayout.com.br/v1/payin/payments/payin-refund/{refundId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sandbox.wepayout.com.br/v1/payin/payments/payin-refund/{refundId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sandbox.wepayout.com.br/v1/payin/payments/payin-refund/{refundId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.wepayout.com.br/v1/payin/payments/payin-refund/{refundId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.wepayout.com.br/v1/payin/payments/payin-refund/{refundId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sandbox.wepayout.com.br/v1/payin/payments/payin-refund/{refundId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.wepayout.com.br/v1/payin/payments/payin-refund/{refundId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": 12345,
"payin_id": 32457,
"status_id": 4,
"user": {
"id": 1,
"name": "Admin User"
},
"name": "PAID",
"notification": "string",
"created_at": "2024-06-12T23:10:00.000000Z",
"end_to_end_id": "E1805820220621234567890AB1C2",
"reason": "Customer requested refund",
"wallet_error_code": null,
"notification_url": "https://client.callback.com/notify-payin",
"updated_at": "2024-06-12T23:15:00.000000Z",
"refund_amount": 5000,
"status_history": [
{
"id": 1,
"status_id": 2,
"name": "REQUESTED",
"notification": "Refund requested",
"created_at": "2024-06-12T23:10:00.000000Z",
"end_to_end_id": null
},
{
"id": 2,
"status_id": 4,
"name": "PAID",
"notification": "Refund completed",
"created_at": "2024-06-12T23:15:00.000000Z",
"end_to_end_id": "E1805820220621234567890AB1C2"
}
]
}
{
"message": "Refund not found"
}
Refund
Get Unique Refund
Returns the refund using its unique identifier
GET
/
v1
/
payin
/
payments
/
payin-refund
/
{refundId}
Get Unique Refund
curl --request GET \
--url https://api.sandbox.wepayout.com.br/v1/payin/payments/payin-refund/{refundId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sandbox.wepayout.com.br/v1/payin/payments/payin-refund/{refundId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sandbox.wepayout.com.br/v1/payin/payments/payin-refund/{refundId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.wepayout.com.br/v1/payin/payments/payin-refund/{refundId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.wepayout.com.br/v1/payin/payments/payin-refund/{refundId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sandbox.wepayout.com.br/v1/payin/payments/payin-refund/{refundId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.wepayout.com.br/v1/payin/payments/payin-refund/{refundId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": 12345,
"payin_id": 32457,
"status_id": 4,
"user": {
"id": 1,
"name": "Admin User"
},
"name": "PAID",
"notification": "string",
"created_at": "2024-06-12T23:10:00.000000Z",
"end_to_end_id": "E1805820220621234567890AB1C2",
"reason": "Customer requested refund",
"wallet_error_code": null,
"notification_url": "https://client.callback.com/notify-payin",
"updated_at": "2024-06-12T23:15:00.000000Z",
"refund_amount": 5000,
"status_history": [
{
"id": 1,
"status_id": 2,
"name": "REQUESTED",
"notification": "Refund requested",
"created_at": "2024-06-12T23:10:00.000000Z",
"end_to_end_id": null
},
{
"id": 2,
"status_id": 4,
"name": "PAID",
"notification": "Refund completed",
"created_at": "2024-06-12T23:15:00.000000Z",
"end_to_end_id": "E1805820220621234567890AB1C2"
}
]
}
{
"message": "Refund not found"
}
Get Unique Refund
Returns the refund using its unique identifier.Path Parameters
The unique ID of the refund to retrieve.Example:
1234Response
Refund ID.
ID of the payin (payin) that was refunded.
Current status of the refund.Status codes:
2: REQUESTED4: PAID (refund completed)5: ERROR
Refund status ID.
Refund status name.
Notification message.
Creation date time.
End-to-end ID (Pix transaction identifier).
Reason for the refund.
Wallet error code (if applicable).
Payin where notification will be sent.
Creation date time.
Update date time.
Refund value in cents.
Request Example
curl --request GET \
--url https://api.sandbox.wepayout.com.br/v1/payin/payments/payin-refund/1234 \
--header 'Accept: application/json' \
--header 'Authorization: Bearer 123'
async function getRefund(refundId) {
const response = await fetch(
`https://api.sandbox.wepayout.com.br/v1/payin/payments/payin-refund/${refundId}`,
{
method: 'GET',
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer 123'
}
}
);
return await response.json();
}
// Usage
const refund = await getRefund(1234);
console.log('Refund details:', refund);
console.log('Status:', refund.name);
console.log('Amount:', refund.refund_amount / 100);
import requests
def get_refund(refund_id):
url = f'https://api.sandbox.wepayout.com.br/v1/payin/payments/payin-refund/{refund_id}'
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer 123'
}
response = requests.get(url, headers=headers)
return response.json()
# Usage
refund = get_refund(1234)
print(f"Refund details: {refund}")
print(f"Status: {refund['name']}")
print(f"Amount: R$ {refund['refund_amount'] / 100}")
{
"id": 12345,
"payin_id": 32457,
"status_id": 4,
"user": {
"id": 1,
"name": "Admin User"
},
"name": "PAID",
"notification": "string",
"created_at": "2024-06-12T23:10:00.000000Z",
"end_to_end_id": "E1805820220621234567890AB1C2",
"reason": "Customer requested refund",
"wallet_error_code": null,
"notification_url": "https://client.callback.com/notify-payin",
"updated_at": "2024-06-12T23:15:00.000000Z",
"refund_amount": 5000,
"status_history": [
{
"id": 1,
"status_id": 2,
"name": "REQUESTED",
"notification": "Refund requested",
"created_at": "2024-06-12T23:10:00.000000Z",
"end_to_end_id": null
},
{
"id": 2,
"status_id": 4,
"name": "PAID",
"notification": "Refund completed",
"created_at": "2024-06-12T23:15:00.000000Z",
"end_to_end_id": "E1805820220621234567890AB1C2"
}
]
}
{
"message": "Refund not found"
}
Use Cases
Check Refund Status
Check Refund Status
Monitor the status of a refund:
async function checkRefundStatus(refundId) {
const refund = await getRefund(refundId);
const statusMap = {
2: 'REQUESTED - Refund is being processed',
4: 'PAID - Refund completed successfully',
5: 'ERROR - Refund failed'
};
console.log(`Refund ${refundId}:`);
console.log(`Status: ${statusMap[refund.status_id]}`);
console.log(`Amount: R$ ${refund.refund_amount / 100}`);
console.log(`Reason: ${refund.reason}`);
return refund.status_id === 4;
}
Track Refund History
Track Refund History
View the complete history of a refund:
async function trackRefundHistory(refundId) {
const refund = await getRefund(refundId);
console.log(`Refund history for ID ${refundId}:`);
refund.status_history.forEach(history => {
console.log(`${history.created_at}: ${history.name} - ${history.notification}`);
});
return refund.status_history;
}
Verify Refund Completion
Verify Refund Completion
Check if a refund has been completed:
async function verifyRefundCompletion(refundId) {
const refund = await getRefund(refundId);
const isCompleted = refund.status_id === 4;
const hasFailed = refund.status_id === 5;
if (isCompleted) {
console.log(`Refund completed successfully`);
console.log(`End-to-end ID: ${refund.end_to_end_id}`);
return true;
}
if (hasFailed) {
console.log(`Refund failed`);
console.log(`Error: ${refund.wallet_error_code}`);
return false;
}
console.log(`Refund still processing`);
return null;
}
Get Refund Details for Reconciliation
Get Refund Details for Reconciliation
Retrieve refund details for accounting reconciliation:
async function getRefundForReconciliation(refundId) {
const refund = await getRefund(refundId);
return {
refundId: refund.id,
payinId: refund.payin_id,
amount: refund.refund_amount / 100,
status: refund.name,
endToEndId: refund.end_to_end_id,
reason: refund.reason,
createdAt: refund.created_at,
completedAt: refund.updated_at,
user: refund.user.name
};
}
// Usage
const reconciliation = await getRefundForReconciliation(1234);
console.log('Reconciliation data:', reconciliation);
Monitor Multiple Refunds
Monitor Multiple Refunds
Check status of multiple refunds:
async function monitorRefunds(refundIds) {
const results = [];
for (const refundId of refundIds) {
try {
const refund = await getRefund(refundId);
results.push({
id: refundId,
status: refund.name,
amount: refund.refund_amount,
completed: refund.status_id === 4
});
} catch (error) {
results.push({
id: refundId,
error: error.message
});
}
}
return results;
}
// Usage
const refundIds = [1234, 1235, 1236];
const statuses = await monitorRefunds(refundIds);
console.log('Refund statuses:', statuses);
Status Codes
| Status ID | Status Name | Description |
|---|---|---|
| 2 | REQUESTED | Refund has been requested and is being processed |
| 4 | PAID | Refund has been completed successfully |
| 5 | ERROR | Refund has failed |
Best Practices
Status History: Use the
status_history array to track the complete timeline of the refund process.End-to-End ID: The
end_to_end_id is only available after the refund is completed (status = PAID). Use it for Pix transaction tracking.Error Handling: Always check the
wallet_error_code field when status is ERROR to understand why the refund failed.Was this page helpful?
⌘I

