> For the complete documentation index, see [llms.txt](https://moonie.gitbook.io/mooniepay/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://moonie.gitbook.io/mooniepay/payouts/verify-payout.md).

# Verify payout

Force a real-time status check directly against the payment provider. Unlike [Retrieve Payout](/mooniepay/payouts/retrieve-payout.md), which returns the cached status from MooniePay's database, this endpoint contacts the provider's API and syncs the latest status before returning.

***

### When to use this

Use `verify` when:

* You did not receive a webhook and want to check if the transaction resolved manually
* You want to confirm a status before fulfilling an order
* You are building a polling fallback for cases where webhooks fail

> 💡 For normal status monitoring, prefer [webhooks](/mooniepay/introduction/webhooks.md). Use `verify` as a safety net — not as a replacement for webhooks.

***

### Endpoint

```
GET https://api.pay.movemoonie.com/v1/payouts/{transactionId}/verify
```

***

### Path Parameter

| Parameter       | Description                                                           |
| --------------- | --------------------------------------------------------------------- |
| `transactionId` | The MooniePay transaction ID returned when the payment was initiated. |

***

### Code Examples

{% tabs %}
{% tab title="PHP" %}

```php
<?php

$publicKey     = 'pk_sandbox_payout_xxxxxxxxxxxx';
$secretKey     = 'your_secret_key_here';
$environment   = 'sandbox';
$timestamp     = time();
$transactionId = 'TESxxxxxxxxxxxx';

$method  = 'GET';
$path    = "/v1/payouts/{$transactionId}/verify";
$payload = '';

$stringToSign = "{$publicKey}.{$timestamp}.{$method}.{$path}.{$payload}";
$signature    = hash_hmac('sha256', $stringToSign, $secretKey);

$ch = curl_init("https://api.pay.movemoonie.com{$path}");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        "Authorization: {$publicKey}",
        "X-TTUM-Timestamp: {$timestamp}",
        "X-TTUM-Signature: {$signature}",
        "X-TTUM-Environment: {$environment}",
    ],
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);

if ($response['success'] && $response['data']['status'] === 'completed') {
    // ✅ Payment confirmed — fulfil order
}
```

{% endtab %}

{% tab title="NodeJs" %}

```javascript
const crypto = require('crypto');
const https  = require('https');

const publicKey     = 'pk_sandbox_payout_xxxxxxxxxxxx';
const secretKey     = 'your_secret_key_here';
const environment   = 'sandbox';
const timestamp     = Math.floor(Date.now() / 1000);
const transactionId = 'TESxxxxxxxxxxxx';

const method  = 'GET';
const path    = `/v1/payouts/${transactionId}/verify`;
const payload = '';

const stringToSign = `${publicKey}.${timestamp}.${method}.${path}.${payload}`;
const signature    = crypto.createHmac('sha256', secretKey).update(stringToSign).digest('hex');

https.get({
  hostname: 'api.pay.movemoonie.com', path,
  headers: {
    'Authorization': publicKey, 'X-TTUM-Timestamp': timestamp.toString(),
    'X-TTUM-Signature': signature, 'X-TTUM-Environment': environment,
  },
}, (res) => {
  let data = '';
  res.on('data', chunk => data += chunk);
  res.on('end', () => {
    const json = JSON.parse(data);
    if (json.success && json.data.status === 'completed') {
      // ✅ Fulfil order
    }
  });
});
```

{% endtab %}

{% tab title="Python" %}

```python
import hmac, hashlib, time, requests

public_key     = 'pk_sandbox_payout_xxxxxxxxxxxx'
secret_key     = 'your_secret_key_here'
environment    = 'sandbox'
timestamp      = int(time.time())
transaction_id = 'TESxxxxxxxxxxxx'

method  = 'GET'
path    = f'/v1/payouts/{transaction_id}/verify'
payload = ''

string_to_sign = f"{public_key}.{timestamp}.{method}.{path}.{payload}"
signature = hmac.new(secret_key.encode(), string_to_sign.encode(), hashlib.sha256).hexdigest()

response = requests.get(
    f'https://api.pay.movemoonie.com{path}',
    headers={
        'Authorization': public_key, 'X-TTUM-Timestamp': str(timestamp),
        'X-TTUM-Signature': signature, 'X-TTUM-Environment': environment,
    }
).json()

if response['success'] and response['data']['status'] == 'completed':
    print('Payment confirmed — fulfil order')
```

{% endtab %}

{% tab title="cURL" %}

```shellscript
PUBLIC_KEY="pk_sandbox_payout_xxxxxxxxxxxx"
SECRET_KEY="your_secret_key_here"
ENVIRONMENT="sandbox"
TIMESTAMP=$(date +%s)
TRANSACTION_ID="TESxxxxxxxxxxxx"
METHOD="GET"
PATH="/v1/payouts/${TRANSACTION_ID}/verify"

STRING_TO_SIGN="${PUBLIC_KEY}.${TIMESTAMP}.${METHOD}.${PATH}."
SIGNATURE=$(echo -n "$STRING_TO_SIGN" | openssl dgst -sha256 -hmac "$SECRET_KEY" | awk '{print $2}')

curl "https://api.pay.movemoonie.com${PATH}" \
  -H "Authorization: $PUBLIC_KEY" \
  -H "X-TTUM-Timestamp: $TIMESTAMP" \
  -H "X-TTUM-Signature: $SIGNATURE" \
  -H "X-TTUM-Environment: $ENVIRONMENT"
```

{% endtab %}
{% endtabs %}

***

### Response

#### Success — `200 OK`

Returns the same full transaction object as [Retrieve Payout](/mooniepay/payouts/retrieve-payout.md), but with the status updated in real time from the provider.

```json
{
  "success": true,
  "message": "Payment completed successfully.",
  "data": {
    "id": "txn_xxxxxxxxxxxxxxxx",
    "type": "payout",
    "status": "completed",
    "amount": 5000,
    "currency": "XAF",
    "completed_at": "2024-06-10T12:00:45.000000Z",
    "payment_method": {
      "code": "momo_cm",
      "name": "MTN Mobile Money Cameroon"
    }
  }
}
```

#### Transaction Status Values

| Status       | Description                                                        |
| ------------ | ------------------------------------------------------------------ |
| `processing` | The provider has received the request — awaiting customer action.  |
| `completed`  | The payment was approved and funds were collected.                 |
| `failed`     | The payment failed (timeout, rejection, insufficient funds, etc.). |
| `cancelled`  | The payment was cancelled.                                         |

#### Error Responses

| HTTP  | Code               | Reason                                         |
| ----- | ------------------ | ---------------------------------------------- |
| `404` | `PAYOUT_NOT_FOUND` | No payment found for the given transaction ID. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://moonie.gitbook.io/mooniepay/payouts/verify-payout.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
