Skip to main content
GET
https://api.sandbox.wepayout.com.br
/
v2
/
payout
/
payments
/
{id}
Get Unique Payment
curl --request GET \
  --url https://api.sandbox.wepayout.com.br/v2/payout/payments/{id} \
  --header 'Authorization: Bearer <token>'
{
  "id": 54321,
  "merchant_id": 1234,
  "amount": 10000,
  "currency": "BRL",
  "country": "BR",
  "description": "Payment for services rendered",
  "recipient": {
    "name": "João Silva",
    "email": "[email protected]",
    "document": {
      "type": "CPF",
      "number": "12345678900"
    },
    "bank_account": {
      "bank_code": "001",
      "branch": "1234",
      "account": "12345678",
      "account_digit": "9",
      "account_type": "checking"
    }
  },
  "status": {
    "id": 3,
    "name": "Paid"
  },
  "external_id": "ORDER-12345",
  "notification_url": "https://your-domain.com/webhook/payout",
  "created_at": "2024-06-13T10:00:00.000000Z",
  "updated_at": "2024-06-13T10:05:00.000000Z"
}

Get Unique Payment

Get details of a specific payout payment by ID.

Path Parameters

id
integer
required
The ID of the payout payment to retrieve.Example: 54321

Response

Returns a single payout payment object with all details.
id
integer
WEpayment’s auto generated payout ID.
merchant_id
integer
Merchant ID that created the payout.
amount
integer
Payout amount in cents.
currency
string
Currency code.
country
string
Country code.
description
string
Payout description.
recipient
object
Recipient information.
status
object
Payout status.
external_id
string
Your internal reference ID.
notification_url
string
Webhook notification URL.
created_at
string
Creation timestamp.
updated_at
string
Last update timestamp.

Request Example

curl --request GET \
  --url https://api.sandbox.wepayout.com.br/v2/payout/payments/54321 \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer 123'
{
  "id": 54321,
  "merchant_id": 1234,
  "amount": 10000,
  "currency": "BRL",
  "country": "BR",
  "description": "Payment for services rendered",
  "recipient": {
    "name": "João Silva",
    "email": "[email protected]",
    "document": {
      "type": "CPF",
      "number": "12345678900"
    },
    "bank_account": {
      "bank_code": "001",
      "branch": "1234",
      "account": "12345678",
      "account_digit": "9",
      "account_type": "checking"
    }
  },
  "status": {
    "id": 3,
    "name": "Paid"
  },
  "external_id": "ORDER-12345",
  "notification_url": "https://your-domain.com/webhook/payout",
  "created_at": "2024-06-13T10:00:00.000000Z",
  "updated_at": "2024-06-13T10:05:00.000000Z"
}

Use Cases

Monitor the status of a specific payout:
async function checkPaymentStatus(paymentId) {
  const payment = await getPayment(paymentId);
  
  console.log(`Payment ${paymentId}:`);
  console.log(`Status: ${payment.status.name}`);
  console.log(`Amount: R$ ${payment.amount / 100}`);
  console.log(`Recipient: ${payment.recipient.name}`);
  
  return payment.status.id === 3; // 3 = Paid
}
Check if a payout has been completed:
async function verifyPaymentCompletion(paymentId) {
  const payment = await getPayment(paymentId);
  
  const isPaid = payment.status.id === 3;
  const isFailed = payment.status.id === 4;
  const isRejected = payment.status.id === 5;
  
  if (isPaid) {
    console.log('Payment completed successfully');
    return true;
  }
  
  if (isFailed || isRejected) {
    console.log(`Payment failed: ${payment.status.name}`);
    return false;
  }
  
  console.log('Payment still processing');
  return null;
}
Retrieve payment details for accounting reconciliation:
async function getPaymentForReconciliation(paymentId) {
  const payment = await getPayment(paymentId);
  
  return {
    paymentId: payment.id,
    externalId: payment.external_id,
    amount: payment.amount / 100,
    status: payment.status.name,
    recipient: {
      name: payment.recipient.name,
      document: payment.recipient.document.number,
      bank: payment.recipient.bank_account.bank_code,
      account: `${payment.recipient.bank_account.branch}-${payment.recipient.bank_account.account}-${payment.recipient.bank_account.account_digit}`
    },
    createdAt: payment.created_at,
    completedAt: payment.updated_at
  };
}

// Usage
const reconciliation = await getPaymentForReconciliation(54321);
console.log('Reconciliation data:', reconciliation);
Find and track a payment using your internal reference:
async function trackPaymentByExternalId(externalId) {
  // First, list payments filtered by external_id
  const listResponse = await fetch(
    `https://api.sandbox.wepayout.com.br/v2/payout/payments?external_id=${externalId}`,
    {
      headers: {
        'Authorization': 'Bearer 123',
        'Accept': 'application/json'
      }
    }
  );
  
  const list = await listResponse.json();
  
  if (list.data.length === 0) {
    throw new Error('Payment not found');
  }
  
  // Get full details
  const paymentId = list.data[0].id;
  return await getPayment(paymentId);
}

// Usage
const payment = await trackPaymentByExternalId('ORDER-12345');
console.log('Payment status:', payment.status.name);
Check status of multiple payouts:
async function monitorPayments(paymentIds) {
  const results = [];
  
  for (const paymentId of paymentIds) {
    try {
      const payment = await getPayment(paymentId);
      results.push({
        id: paymentId,
        status: payment.status.name,
        amount: payment.amount,
        completed: payment.status.id === 3
      });
    } catch (error) {
      results.push({
        id: paymentId,
        error: error.message
      });
    }
  }
  
  return results;
}

// Usage
const paymentIds = [54321, 54322, 54323];
const statuses = await monitorPayments(paymentIds);
console.log('Payment statuses:', statuses);

Status Codes

Status IDStatus NameDescription
1CreatedPayout has been created
2ProcessingPayout is being processed
3PaidPayout has been paid successfully
4FailedPayout failed
5RejectedPayout rejected by compliance
6CancelledPayout was cancelled

Best Practices

Status Monitoring: Use webhooks instead of polling this endpoint repeatedly to check payment status.
External ID: Use the external_id to track payments in your system and correlate with your internal records.
Error Handling: Always implement proper error handling for 404 responses when the payment ID doesn’t exist.

Integration Example

class PayoutService {
  constructor(apiKey) {
    this.apiKey = apiKey;
    this.baseUrl = 'https://api.sandbox.wepayout.com.br/v2';
  }
  
  async getPayment(paymentId) {
    const response = await fetch(
      `${this.baseUrl}/payout/payments/${paymentId}`,
      {
        headers: {
          'Authorization': `Bearer ${this.apiKey}`,
          'Accept': 'application/json'
        }
      }
    );
    
    if (!response.ok) {
      throw new Error(`Failed to get payment: ${response.statusText}`);
    }
    
    return await response.json();
  }
  
  async waitForPaymentCompletion(paymentId, maxAttempts = 20, intervalMs = 5000) {
    for (let i = 0; i < maxAttempts; i++) {
      const payment = await this.getPayment(paymentId);
      
      if (payment.status.id === 3) {
        return {
          success: true,
          payment,
          message: 'Payment completed successfully'
        };
      }
      
      if (payment.status.id === 4 || payment.status.id === 5) {
        return {
          success: false,
          payment,
          message: `Payment ${payment.status.name.toLowerCase()}`
        };
      }
      
      // Still processing, wait before next check
      await new Promise(resolve => setTimeout(resolve, intervalMs));
    }
    
    return {
      success: false,
      message: 'Timeout waiting for payment completion'
    };
  }
}

// Usage
const payoutService = new PayoutService('YOUR_API_KEY');

// Get payment details
const payment = await payoutService.getPayment(54321);
console.log('Payment:', payment);

// Wait for payment to complete
const result = await payoutService.waitForPaymentCompletion(54321);
if (result.success) {
  console.log('Payment completed:', result.payment);
} else {
  console.error('Payment failed:', result.message);
}