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

# Get Unique Payment

> Get details of a specific payout payment by ID

# Get Unique Payment

Get details of a specific payout payment by ID.

## Path Parameters

<ParamField path="id" type="integer" required>
  The ID of the payout payment to retrieve.

  Example: `54321`
</ParamField>

## Response

Returns a single payout payment object with all details.

<ResponseField name="id" type="integer">
  WEpayment's auto generated payout ID.
</ResponseField>

<ResponseField name="merchant_id" type="integer">
  Merchant ID that created the payout.
</ResponseField>

<ResponseField name="amount" type="integer">
  Payout amount in cents.
</ResponseField>

<ResponseField name="currency" type="string">
  Currency code.
</ResponseField>

<ResponseField name="country" type="string">
  Country code.
</ResponseField>

<ResponseField name="description" type="string">
  Payout description.
</ResponseField>

<ResponseField name="recipient" type="object">
  Recipient information.

  <Expandable title="Recipient">
    <ResponseField name="name" type="string">
      Recipient's full name.
    </ResponseField>

    <ResponseField name="email" type="string">
      Recipient's email address.
    </ResponseField>

    <ResponseField name="document" type="object">
      Recipient's document.

      <Expandable title="Document">
        <ResponseField name="type" type="string">
          Document type (CPF, CNPJ).
        </ResponseField>

        <ResponseField name="number" type="string">
          Document number.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="bank_account" type="object">
      Recipient's bank account information.

      <Expandable title="Bank Account">
        <ResponseField name="bank_code" type="string">
          Bank code (ISPB or COMPE code).
        </ResponseField>

        <ResponseField name="branch" type="string">
          Bank branch number.
        </ResponseField>

        <ResponseField name="account" type="string">
          Bank account number.
        </ResponseField>

        <ResponseField name="account_digit" type="string">
          Bank account digit.
        </ResponseField>

        <ResponseField name="account_type" type="string">
          Account type (checking, savings).
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="status" type="object">
  Payout status.

  <Expandable title="Status">
    <ResponseField name="id" type="integer">
      Status ID.
    </ResponseField>

    <ResponseField name="name" type="string">
      Status name.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="external_id" type="string">
  Your internal reference ID.
</ResponseField>

<ResponseField name="notification_url" type="string">
  Webhook notification URL.
</ResponseField>

<ResponseField name="created_at" type="string">
  Creation timestamp.
</ResponseField>

<ResponseField name="updated_at" type="string">
  Last update timestamp.
</ResponseField>

## Request Example

<CodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url https://api.sandbox.wepayout.com.br/v2/payout/payments/54321 \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer 123'
  ```

  ```javascript JavaScript theme={null}
  async function getPayment(paymentId) {
    const response = await fetch(
      `https://api.sandbox.wepayout.com.br/v2/payout/payments/${paymentId}`,
      {
        method: 'GET',
        headers: {
          'Accept': 'application/json',
          'Authorization': 'Bearer 123'
        }
      }
    );
    
    return await response.json();
  }

  // Usage
  const payment = await getPayment(12345);
  console.log('Payment details:', payment);
  console.log('Status:', payment.status.name);
  console.log('Amount:', payment.amount / 100);
  console.log('Recipient:', payment.recipient.name);
  ```

  ```python Python theme={null}
  import requests

  def get_payment(payment_id):
      url = f'https://api.sandbox.wepayout.com.br/v2/payout/payments/{payment_id}'
      headers = {
          'Accept': 'application/json',
          'Authorization': 'Bearer 123'
      }
      
      response = requests.get(url, headers=headers)
      return response.json()

  # Usage
  payment = get_payment(54321)
  print(f"Payment details: {payment}")
  print(f"Status: {payment['status']['name']}")
  print(f"Amount: R$ {payment['amount'] / 100}")
  print(f"Recipient: {payment['recipient']['name']}")
  ```
</CodeGroup>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "id": 54321,
    "merchant_id": 1234,
    "amount": 10000,
    "currency": "BRL",
    "country": "BR",
    "description": "Payment for services rendered",
    "recipient": {
      "name": "João Silva",
      "email": "joao@example.com",
      "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"
  }
  ```

  ```json 404 Not Found theme={null}
  {
    "message": "Payment not found"
  }
  ```
</ResponseExample>

## Use Cases

<AccordionGroup>
  <Accordion title="Check Payment Status">
    Monitor the status of a specific payout:

    ```javascript theme={null}
    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
    }
    ```
  </Accordion>

  <Accordion title="Verify Payment Completion">
    Check if a payout has been completed:

    ```javascript theme={null}
    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;
    }
    ```
  </Accordion>

  <Accordion title="Get Payment Details for Reconciliation">
    Retrieve payment details for accounting reconciliation:

    ```javascript theme={null}
    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);
    ```
  </Accordion>

  <Accordion title="Track Payment by External ID">
    Find and track a payment using your internal reference:

    ```javascript theme={null}
    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);
    ```
  </Accordion>

  <Accordion title="Monitor Multiple Payments">
    Check status of multiple payouts:

    ```javascript theme={null}
    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);
    ```
  </Accordion>
</AccordionGroup>

## Status Codes

| Status ID | Status Name | Description                       |
| --------- | ----------- | --------------------------------- |
| 1         | Created     | Payout has been created           |
| 2         | Processing  | Payout is being processed         |
| 3         | Paid        | Payout has been paid successfully |
| 4         | Failed      | Payout failed                     |
| 5         | Rejected    | Payout rejected by compliance     |
| 6         | Cancelled   | Payout was cancelled              |

## Best Practices

<Note>
  **Status Monitoring**: Use webhooks instead of polling this endpoint repeatedly to check payment status.
</Note>

<Tip>
  **External ID**: Use the external\_id to track payments in your system and correlate with your internal records.
</Tip>

<Warning>
  **Error Handling**: Always implement proper error handling for 404 responses when the payment ID doesn't exist.
</Warning>

## Related Resources

<CardGroup cols={3}>
  <Card title="Create Payment" icon="plus" href="/api-reference/cash-out/payout/create-payment">
    Create a new payout payment
  </Card>

  <Card title="List Payments" icon="list" href="/api-reference/cash-out/payout/list-payment">
    List all payout payments
  </Card>

  <Card title="Callback Payment" icon="webhook" href="/api-reference/cash-out/payout/callback-payment">
    Receive payment status updates
  </Card>

  <Card title="Get Balance" icon="wallet" href="/api-reference/account/get-balance">
    Check your wallet balance
  </Card>

  <Card title="Get Statement" icon="file-invoice" href="/api-reference/account/get-statement">
    View account statement
  </Card>
</CardGroup>
