# Vérifier un transfert

Il existe trois façons de connaître le statut d'un transfert :

1. Confirmez que la référence de la transaction correspond à celle que vous avez générée.
2. Vérifiez l'exactitude du statut de la transaction. Le statut de la transaction doit être "success" pour les paiements réussis. Pour en savoir plus sur les statuts de transaction, consultez la section "Statut de transaction".
3. Vérifiez que la devise du transfert correspond à la devise attendue.

Assurez-vous que le montant payé est égal ou supérieur au montant prévu. Si le montant est supérieur, vous pouvez fournir au client la valeur correspondante et rembourser l'excédent.

Pour authentifier un paiement, utilisez la route de vérification d'une transaction `/v1/payments/{paymentId}/verify`, en spécifiant l'identifiant de la transaction dans l'URL. Vous pouvez obtenir l'ID de la transaction à partir du champ `data.id` dans la réponse après la création de la transaction, ainsi que dans le contenu du Webhook pour toute transaction.

### Requête

```bash
GET /v1/payments/{paymentId}/verify HTTP/1.1
Host: https://api.moneroo.io
Authorization: Bearer YOUR_SECRET_KEY
Content-Type: application/json
Accept: application/json
```

#### Paramètres

* Route: `/v1/payments/{paymentId}/verify`
* Méthode: `GET`

<table><thead><tr><th width="153">Nom</th><th width="140">Type</th><th width="94">Requis</th><th>Description</th></tr></thead><tbody><tr><td><code>paymentId</code></td><td>String</td><td>Oui</td><td>L'id de l'opération de transfert à vérifier.</td></tr></tbody></table>

### **Response Structure**

The response from this API endpoint will be in the standard Moneroo API response format. You'll get a response that looks like this:

```json
{
  "success": true,
  "message": "Payment transaction fetched successfully",
  "data": {
    // Details of the payment transaction
  }
}
```

En cas de requête réussie, la route de l'API retourne un code de statut HTTP 200 et les détails de la transaction de paiement dans le corps de la réponse.

S'il y a un problème avec votre requête, l'API renverra une réponse d'erreur. Le type de réponse d'erreur dépend de la nature du problème.

* **401 Unauthorized** : Cette erreur est renvoyée si vous n'avez pas fourni un jeton d'autorisation valide dans votre requête.
* **404 Not Found** : Cette erreur est renvoyée si l'ID de paiement fourni ne correspond à aucune transaction dans le système.
* **500 Internal Server Error** : Cette erreur indique un problème inattendu sur le serveur lors du traitement de votre requête.

### Considérations de sécurité

Cette route de l'API nécessite un jeton `Bearer` pour l'authentification. Le jeton `Bearer` doit être inclus dans l'en-tête Authorization de la requête. Assurez-vous que le jeton est gardé en sécurité et qu'il n'est ni partagé ni exposé de manière inappropriée.

### Exemple

{% hint style="warning" %}
Veuillez remplacer `payoutId` par l'identifiant de la transaction de paiement et `your_token` par votre jeton d'autorisation valide dans les extraits de code ci-dessous.
{% endhint %}

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

```bash
curl --location --request GET 'https://api.moneroo.io/v1/payouts/{payoutId}/verify' \
--header 'Authorization: Bearer YOUR_TOKEN'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$payoutId = 'your_payment_id';
$token = 'your_token';

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.moneroo.io/v1/payouts/{$payoutId}/verify",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer {$token}"
  ]
]);

$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

if ($httpCode === 200) {
  // Handle successful response
} else {
  // Handle error response
}

curl_close($curl);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

payoutId = 'your_payment_id'
token = 'your_token'

headers = {
  'Authorization': f'Bearer {token}'
}

response = requests.get(f'https://api.moneroo.io/v1/payouts/{payoutId}/verify', headers=headers)

if response.status_code == 200:
  # Handle successful response
else:
  # Handle error response
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"fmt"
	"net/http"
)

func main() {
	payoutId := "your_payment_id"
	token := "your_token"

	url := fmt.Sprintf("https://api.moneroo.io/v1/payouts/%s/verify", paymentId)
	req, err := http.NewRequest("GET", url, nil)
	if err != nil {
		// Handle error
	}

	req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token))

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		// Handle error
	}
	defer resp.Body.Close()

	if resp.StatusCode == 200 {
		// Handle successful response
	} else {
		// Handle error response
	}
}
```

{% endtab %}

{% tab title="JavaScript (Node.js)" %}

```javascript
const axios = require("axios");

const paymentId = "your_payment_id";
const token = "your_token";

axios
  .get(`https://api.moneroo.io/v1/payouts/${payoutId}/verify`, {
    headers: {
      Authorization: `Bearer ${token}`,
    },
  })
  .then((response) => {
    if (response.status === 200) {
      // Handle successful response
    } else {
      // Handle error response
    }
  })
  .catch((error) => {
    // Handle error
  });
```

{% endtab %}
{% endtabs %}

####

### Response example

You'll get a response that looks like this:

```json
{
  "success": true,
  "message": "Payout transaction fetched successfully",
  "data": {
    "id": "abc123",
    "status": "success",
    "is_processed": true,
    "processed_at": "2023-05-21T12:00:00Z",
    "amount": 100.0,
    "currency": "USD",
    "amount_formatted": "$100.00",
    "description": "Purchase of goods",
    "return_url": "https://example.com/return",
    "environment": "production",
    "initiated_at": "2023-05-21T11:00:00Z",
    "checkout_url": "https://example.com/checkout",
    "payment_phone_number": "+1234567890",
    "app": {
      "id": "app1",
      "name": "Example App",
      "icon_url": "https://example.com/icon.png"
    },
    "customer": {
      "id": "cust1",
      "first_name": "John",
      "last_name": "Doe",
      "email": "john.doe@example.com",
      "phone": "+1234567890",
      "address": "123 Main St",
      "city": "Springfield",
      "state": "IL",
      "country_code": "US",
      "country": "United States",
      "zip_code": "62701",
      "environment": "production",
      "created_at": "2023-01-01T00:00:00Z",
      "updated_at": "2023-05-21T00:00:00Z"
    },
    "method": {
      "name": "Credit Card",
      "code": "cc",
      "icon_url": "https://example.com/cc.png",
      "environment": "production"
    },
    "gateway": {
      "name": "Stripe",
      "account_name": "Acme Corp",
      "code": "stripe",
      "icon_url": "https://example.com/stripe.png",
      "environment": "production"
    },
    "metadata": {
      "custom_field1": "custom_value1",
      "custom_field2": "custom_value2"
    },
  }
}
```

The transaction details are contained in the data object. For instance:

* The status of the transaction is in `data.status`.
* The details of the customer are in the `data.customer` field.
* The data.amount field says how much the customer was charged.
* Some fields will vary depending on the type of transaction or state of the transaction.
* The data.method field contains the payment method used by the customer.
* The data.gateway field contains the payment gateway used to process the transaction.
* The data.metadata field contains any custom metadata you may have provided when creating the transaction.
* The data.context field contains the context of the transaction.
* The data.app field contains the app details.

| Field Name             | Description                                          |
| ---------------------- | ---------------------------------------------------- |
| `id`                   | The public ID of the transaction.                    |
| `status`               | The status of the transaction.                       |
| `is_processed`         | Indicates whether the transaction is processed.      |
| `processed_at`         | The time when the transaction was processed.         |
| `amount`               | The amount involved in the transaction.              |
| `currency`             | The currency used in the transaction.                |
| `amount_formatted`     | The formatted amount involved in the transaction.    |
| `description`          | The description of the transaction.                  |
| `return_url`           | The URL to return to after the transaction.          |
| `environment`          | The environment in which the transaction occurred.   |
| `initiated_at`         | The time when the transaction was initiated.         |
| `checkout_url`         | The URL to checkout the transaction.                 |
| `payment_phone_number` | The phone number associated with the payment method. |
| `app`                  | The app associated with the transaction.             |
| `customer`             | The customer associated with the transaction.        |
| `method`               | The payment method associated with the transaction.  |
| `gateway`              | The payment gateway associated with the transaction. |
| `metadata`             | The metadata associated with the transaction.        |
| `context`              | The context associated with the transaction.         |


---

# Agent Instructions: 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:

```
GET https://docs.moneroo.io/fr/payouts/verifier-un-transfert.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
