# VerifyPGPaymentWithToken

## Verify pg pay payment with pgpay token

<mark style="color:green;">`POST`</mark> `https://sandbox.pgecom.com/api/pgpay/order`

#### Request Body

| Name                                         | Type   | Description |
| -------------------------------------------- | ------ | ----------- |
| pgPayToken<mark style="color:red;">\*</mark> | String | The token   |

{% tabs %}
{% tab title="200: OK success" %}

```json
{
    "quantity": 1,
    "receiver": "wysavmuhjsuxpv@lifebeyondservice.com",
    "metadata": {
        "is_matched": false,
        "gender": "female",
        "isChatEnabled": false,
        "isProd": false,
        "webhookUrl": "https://webhook.site/40adf10b-9352-4d20-b23a-17d4f1a32a9f",
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJvcmRlcklkIjoiNDE0MTJiZTMtMDFmZC00ODhhLWEyNzktY2FkYmUxNzFiNWU1IiwiaWF0IjoxNzEzNDU5MjE2LCJleHAiOjE3MTM0NjI4MTZ9.-LqeTBDi1vOT1giyOLfnQ5hrpmrtrKbWxB_SqvZD5mU",
        "app_name": "Match.com",
        "pgPayMerchantName": "PGecom",
        "customerEmail": "info@pgecom.com",
        "paymentMethods": [
            "moncash",
            "pgpay"
        ],
        "customerFirstName": "",
        "customerLastName": "",
        "returnUrl": "https://sandbox.pgecom.com/payment/pgpay/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJvcmRlcklkIjoiNDE0MTJiZTMtMDFmZC00ODhhLWEyNzktY2FkYmUxNzFiNWU1IiwiaWF0IjoxNzEzNDU5MjE2LCJleHAiOjE3MTM0NjI4MTZ9.-LqeTBDi1vOT1giyOLfnQ5hrpmrtrKbWxB_SqvZD5mU?merchantName=PGecom&amount=55"
    },
    "userFee": 0,
    "currency": "htg",
    "newBalance": 5440.35927,
    "orderId": "41412be3-01fd-488a-a279-cadbe171b5e5",
    "status": "completed",
    "successUrl": "https://pgecom.com",
    "createdAt": "2024-04-18T16:53:36.528Z",
    "transactionType": "pgpay_deposit",
    "sender": "info@pgecom.com",
    "paymentStatus": "completed",
    "platform": "pgrewards",
    "updatedAt": "2024-04-18T16:54:36.333Z",
    "userID": "f725076f-ade0-4912-bc86-db1681700d91",
    "amount": 0.3061999999999999,
    "paymentMethod": "pgpay",
    "description": "Esterling Accime paid  you 55 HTG via PG Pay. You've received 55 HTG to your account. Your updated balance is 5440.35927 HTG",
    "id": "41412be3-01fd-488a-a279-cadbe171b5e5",
    "deliveryMethod": "instant",
    "phone": "+50934748112",
    "customerId": "e66d2dac-e514-42b7-8490-de3972709d7e",
    "gourdes": 55
}

```

{% endtab %}

{% tab title="400: Bad Request bad request" %}

```
{
    "message": "Order ID 8db0fd57-5494-45d2-8ede-f045ffbd85b9 already exist, please create a new order id",
    "status": 400
}
```

{% endtab %}
{% endtabs %}

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

```javascript
const axios = require('axios');
let data = {
    "pgPayToken": "jfhsfhsh"
}

let config = {
  method: 'post',
  url: 'https://sandbox.pgecom.com/api/pgpay/order',
  headers: { },
  data : data
};

axios(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://sandbox.pgecom.com/api/pgpay/order"

payload = {
    "pgPayToken": "jfhsfhsh"
}
headers = {}

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

print(response.text)

```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require "uri"
require "net/http"

url = URI("https://sandbox.pgecom.com/api/pgpay/order")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request.body = {
    "pgPayToken": "jfhsfhsh"
}
response = https.request(request)
puts response.read_body

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://sandbox.pgecom.com/api/pgpay/order');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setBody({
    "pgPayToken": "jfhsfhsh"
});
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}
```

{% endtab %}

{% tab title="Curl" %}

```sh
curl --location 'https://sandbox.pgecom.com/api/pgpay/order' \
--data-raw '{
    "pgPayToken": "jfhsfhsh"
}'
```

{% endtab %}
{% endtabs %}


---

# 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.pgecom.com/api-endpoint/payment/pg-pay/verifypgpaymentwithtoken.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.
