# Verify Payment

To make this request, send an authenticated request to the verify endpoint.

## Verify a transaction

<mark style="color:green;">`POST`</mark> `https://api.oneappgo.com/v1/business/verifytrans`

#### Request Body

| Name                                        | Type   | Description           |
| ------------------------------------------- | ------ | --------------------- |
| reference<mark style="color:red;">\*</mark> | String | Transaction reference |

{% hint style="danger" %}
Your secret keys are to be kept secret and only stored on your servers. Do not pass your secret key to front end language where it can be exploited.
{% endhint %}

Take a look at how you might do this:

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

```php
curl --location --request POST 'https://api.oneappgo.com/v1/business/verifytrans' \
--header 'Authorization: Bearer YOUR_SECRET_KEY' \
--form 'reference="634967hg599287"'
```

{% endtab %}

{% tab title="NodeJs" %}

```javascript
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'POST',
  'hostname': 'api.oneappgo.com',
  'path': '/v1/business/verifytrans',
  'headers': {
    'Authorization': 'Bearer YOUR_SECRET_KEY'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"reference\"\r\n\r\n634967hg599287\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--";

req.setHeader('content-type', 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');

req.write(postData);

req.end();
```

{% endtab %}

{% tab title="PHP - cURL" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.oneappgo.com/v1/business/verifytrans',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('reference' => '634967hg599287'),
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer YOUR_SECRET_KEY'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.oneappgo.com/v1/business/verifytrans"

payload={'reference': '634967hg599287'}
files=[

]
headers = {
  'Authorization': 'Bearer YOUR_SECRET_KEY'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)

```

{% endtab %}
{% endtabs %}

## Sample response

```json
{
    "status": true,
    "message": "Successful",
    "reference": ""
    "data": {
            "responsecode": "01",
            "trans_status": "Successful",
            "amount": "150000.00",
            "charged_amount": "150000.00",
            "amount_settled": "150000.00",
            "fee":"0.00",
            "mode": "live environment",
            "env":"live",
            "payment_timestamp": "1694387652",
            "currency": "NGN",
            "reference": "63490b1f59287",
            "customer_reference": "2913_1643371498",
            "transaction_token": "c31f54f3b7986a92d04d1699f51227b3",
            "customer_email": "test@gmail.com",
            "customer_name": "",
            "payment_channel": "paystack",
            "paid_through": "api",
            "payment_time": "28 Jan 2022 01:04"
        }
}
```
