# Introduction

Effortlessly manage organizational finances, facilitate online sales for merchants, and enable users to send gifts, receive payments, and top up mobiles globally.

**Welcome to the PGecom API!**

Our platform simplifies organizational financial tasks, from paying contractors and making bulk purchases online to rewarding employees with diverse gift cards. Merchants can effortlessly manage online stores, accept various payment methods, and facilitate payouts, while users enjoy easy gifting, payment acceptance, and global prepaid mobile top-ups.

We've designed the API so that nearly all functionality available via the web UI is available here.

###

### :globe\_with\_meridians: Looking to learn more?

Read through [core concepts](/guides/entwiksyon) and understand how PGecom API works

### :construction: Ready to build?

Our [sandbox environment](https://sandbox.pgecom.com/signup) is free to start building right away. Follow our [quick start guide](/guides/entwiksyon) or our [Postman collection](https://documenter.getpostman.com/view/17326556/2s7Z15Dho7) to make your first API request in just a few minutes.

### :technologist: Want to use your favorite SDK?

* [Python SDK](https://github.com/ninjaroot-509/python-pg-sdk)
* NodeJS SDK *(Coming Soon)*
* PHP SDK *(Coming Soon)*
* Go SDK *(Coming Soon)*

### :rocket: Ready to launch?

Complete the [production access requirement](/resources/production-access); we'll have you live within 1 business day.

### :question: Have a question or need some help?

For technical issues, [contact info@pgecom.com](mailto:info@pgecom.com). We typically answer in 1 business day.&#x20;


# Getting authenticated

{% hint style="info" %}
We’ll be using the [sandbox environment](https://sandbox.pgecom.com/signin) of our API. The sandbox lets you develop the PG Rewards API using mock data. The sandbox environment's URL is <https://sandbox.pgecom.com/signin>
{% endhint %}

## :key: Getting an API Key

1. Sign up or log in to your sandbox account at: <https://sandbox.pgecom.com/signin>
2. Navigate to **Settings > Developer Setting**
3. Click on **Generate New Credentials t**o get new credentials

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FkhOCQfb62jRfA7BZihGI%2FScreen%20Shot%202023-06-25%20at%2011.15.06%20AM.png?alt=media&amp;token=8b5b127e-5f60-4574-b7f6-15d73804b530" alt=""><figcaption><p>Developer Settings</p></figcaption></figure>

### :tada: Make your first request

## Generate your first token

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

#### Request Body

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

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

```json
{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCIIkpXVCJ9.eyJ1c2VySUQiOiI1ZjU2ZGZhMy1hNDE1LTQ4MTgtODI3NS00GZjNjNlY2UzZmQiLCJpc0FjdGl2ZSI6dHJ1ZSwiaXNBZ2VudCI6dHJ1ZSwiaXNTdXBlckFkbWluIjpmYWxzZSwiYWdlbnRTZXR0aW5nIjp7Il9fdHlwZW5hbWUiOiJTZXR0aW5ncyIsIl9sYXN0Q2hhbmdlZEF0IjoxNjUxMDQ1MDcwMDM1LCJfdmVyc2lvbiI6MSwidG9wVXBGZWVzIjo0LCJ2aXJ0dWFsQ2FyZEZlZXMiOjExLCJ1cGRhdGVkQXQiOiIyMDIyLTA1LTIwVDAxOjIwOjI5LjgzMloiLCJ1c2VySUQiOiI1ZjU2ZGZhMy1hNDE1LTQ4MTgtODI3NS00NGZjNjNlY2UzZmQiLCJ0cmFuc0ZlckZlZXMiOjMsImNyZWF0ZWRBdCI6IjIwMjItMDQtMjdUMDc6Mzc6NTAuMDM1WiIsImlkIjoiNWY1NmRmYTMtYTQxNS00ODE4LTgyNzUtNDRmYzYzZWNlM2ZkIiwiY2FyZEZlZXMiOjV9LCJhZ2VudEJhbmtSZXdhcmRGZWVzIjo3LCJ0b3B1cEZlZXMiOjAuNDEsImFnZW50VHJhbnNGZXJGZWVzIjoxLCJpc1N0cmlwZUlzc3VpbmdFbmFibGVkIjp0cnVlLCJpc0JhbGFuY2VFbmFibGVkIjp0cnVlLCJhZ2VudFBheVBhbEZlZXMiOjQsImNhc2hBcHBGZWVzIjozLCJpc1RvcFVwRW5hYmxlZCI6dHJ1ZSwiaWQiOiI3ODFiYTliOS1lMDJkLTQ3ODktYTRhNi0wNjNiM2UyNTg1N2MiLCJ6ZWxsZUZlZXMiOjMsImZWVzIjo1LCJwYXlwYWxGZWVzIjo4LCJpc1VTQUJhbmtSZXdhcmRzRW5hYmxlZCI6dHJ1ZSwidmlydHVhbENhcmRGZWVzIjo4LCJ1cGRhdGVkQXQiOiIyMDIyLTA2LTMwVDEwOjE3OjIyLjkyMVoiLCJpc1BheVBhbEVuYWJsZWQiOnRydWUsImlzTW9uQ2FzaEVuYWJsZWQiOnRydWUsImFnZW50VG9wdXBGZWVzIjoxLCJpc1N0cmlwZUVuYWJsZWQiOnRydWUsImlzVmlydHVhbENhcmRFbmFibGVkIjp0cnVlLCJhZ2VudENhcmRGZWVzIjo0LCJpc1BheW1lRW5hYmxlZCI6dHJ1ZSwiaWF0IjoxNjU2ODM1MTE4LCJleHAiOjE2NTk0MjcxMTh9.PQwvdewWXJ3UROAleG8Q9pEkeQWtYSaawbtT4EaUOg8"
}
```

{% endtab %}

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

```json
{
    "message": "User not found",
    "status": 400
}
```

{% endtab %}

{% tab title="401: Unauthorized Unauthorized" %}

```json
{
    "message": "API Secret Key is invalid",
    "status": 401
}
```

{% endtab %}
{% endtabs %}

Congrats, you've authenticated and made your first request!

<br>


# Sandbox Environment

Learn about available API environments.

The PGecom sandbox environment is a free and fully-featured environment for application development and testing. Nearly all of the PGecom API is supported in the sandbox environment.

PGecom API users typically develop their applications against the sandbox environment, and then switch their credentials to production when they are ready to go live.

### Using the sandbox environment

#### Domain

| Environment  | URL                                                  |
| ------------ | ---------------------------------------------------- |
| `Sandbox`    | <https://sandbox.pgecom.com>                         |
| `Production` | [https://app.pgecom.com](https://sandbox.pgecom.com) |

### Sandbox environment behavior

#### Test Funds

Every sandbox account comes with $5,000 USD pre-funded balance. You can use this balance to create test cards or send rewards through the API.

#### Test credit cards

| Card Type | Card Number           |
| --------- | --------------------- |
| Accepted  | `4242 4242 4242 4242` |

**Test PayPal Accounts**

| Email                                  | Password   |
| -------------------------------------- | ---------- |
| <sb-lgbiq7374139@business.example.com> | `Xm=ns-E4` |

**Mon Cash Sandbox** *(Only Haiti)*

* Navigate to Mon Cash Sandbox
* Enter the following credentials
  * **Username**: pgecom
  * **PWD**: W\&cWJDHoa7di36
* Add a test Account and Add money to the phone number in order to test

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FYzKHQficCOlwt5LHpF9S%2FScreen%20Shot%202022-09-27%20at%209.30.21%20PM.png?alt=media&amp;token=a0616ea1-daf3-4df7-aa27-9eedaa75dc53" alt=""><figcaption><p>Mon Cash Sandbox Home Page</p></figcaption></figure>

In order to test the mon cash integration

You need to navigate to **Add Test Account** and add a **test number** from Haiti.

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2Fykg8myeXxrvniF0UWUQT%2FScreen%20Shot%202022-09-27%20at%209.31.33%20PM.png?alt=media&amp;token=3643d236-5e0d-4683-9f1d-aa13424bc472" alt=""><figcaption><p>Add Test Numbers. Must be a Haiti Phone Number</p></figcaption></figure>

If you don't have funds in your test number

You won't be able to test it.

add up to 5000 HTG to your **test number** so you can perform some tests

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FrNjh8SyugWsP5EcDcKoT%2FScreen%20Shot%202022-09-27%20at%209.31.38%20PM.png?alt=media&amp;token=402d0e80-1626-4da5-8aea-a70b938a1565" alt=""><figcaption><p>Add funds to the phone test phone number</p></figcaption></figure>

Happy testing!<br>


# Ecommerce

You can use the pgecom platform to manage your online store

Step into the future of e-commerce with our revolutionary platform, empowering merchants to effortlessly launch their online stores and reach a multitude of channels. Seamlessly integrating cutting-edge technology and user-friendly design, our platform is designed to be the ultimate launchpad for your business success.

Merchants can now expand their reach beyond conventional boundaries, tapping into multiple channels with unparalleled ease. Whether it's establishing a presence on popular marketplaces, social media platforms, or other online spaces, our platform provides a centralized hub for managing and optimizing your sales strategies.

From the initial setup to the continuous management of your online store, our platform streamlines the entire process. Easily list and synchronize your products across diverse channels, ensuring that your brand and offerings are consistently presented to a broader audience.

Our commitment to empowering merchants extends beyond just providing a platform – we offer a comprehensive suite of tools and resources to enhance visibility, streamline operations, and maximize sales. Welcome to a world where launching and managing your online store across multiple channels is not just a possibility but a seamless reality. Embrace the future of e-commerce with our platform and watch your business soar to new heights.

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FHNoMe57khLmnxSYTgYzS%2FScreenshot%202023-12-30%20at%201.43.48%E2%80%AFAM.png?alt=media&amp;token=03e02ff1-7cda-4116-b384-eacc562b5887" alt=""><figcaption><p>Merchant Admin Portal</p></figcaption></figure>


# Shop

Take control of your store using the PGecom platform.

The PGecom platform is your all-encompassing solution for seamlessly managing every aspect of your online store.&#x20;

With its user-friendly interface and powerful features, you can effortlessly navigate through the entire process, from the convenient addition of new products to the creative endeavor of crafting collections that resonate with your audience.&#x20;

This centralized platform not only streamlines the management of your store but also simplifies the deployment process, providing you with a cohesive and efficient environment to bring your online storefront to life. Experience the convenience of an all-in-one solution as you optimize and enhance your e-commerce presence with PGecom.


# GetShopById

Use this endpoint to get shop information by id

## Get shop details by shop id

<mark style="color:blue;">`GET`</mark> `https://sandbox.pgecom.com/api/v1/shop/{{shopId}}`

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

```json
{
    "id": "0a40d129-0728-4b10-b32e-117abd6938c3",
    "theme": "default",
    "user": {
        "id": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
        "email": "info@pgecom.com",
        "phone": "+14048253444",
        "avatar": "https://pgecom-staging.s3.amazonaws.com/c5400b13-c8de-4cb2-bc12-f4850958169f-profile.png",
        "verified": true,
        "name": {
            "firstName": "Esterling",
            "lastName": "Accime"
        }
    },
    "email": "info@pgecom.com",
    "name": "facebook",
    "phone": "+1 404 825 3444",
    "merchantId": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "description": "Testing and testing",
    "verified": true,
    "paymentMethods": [
        "stripe"
    ],
    "coverPicture": null,
    "headerColorHex": "#e1e3fd",
    "footerColorHex": "#f7a1f3",
    "primaryColorHex": "#95f695",
    "secondaryColorHex": "#fffcfc",
    "crispWebsiteId": "1b38e124-7b98-4652-9599-b45ff96e5e4c",
    "profilePicture": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1701756145/5f56dfa3-a415-4818-8275-44fc63ece3fd/facebook/logo/image.png",
    "socialLinks": {
        "facebook": null,
        "youtube": null,
        "twitter": null,
        "instagram": null
    },
    "products": [
        {
            "productType": "physical",
            "published": false,
            "inventory": 50,
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "comparePrice": 0,
            "status": "draft",
            "slug": "hair",
            "createdAt": "2023-11-21T13:23:04Z",
            "vendor": "facebook",
            "name": "Hair",
            "isFeatured": false,
            "costPerItem": 0,
            "isContinueSellingOutStock": false,
            "updatedAt": "2023-11-21T13:23:04Z",
            "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
            "description": "This is a simple depo here",
            "price": 29,
            "id": "25333a45-5b26-41a5-9c4f-a886383aa31c",
            "mainImageUrl": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1700572977/facebook/products/whatsapp-image-2023-04-28-at-11.10.17-am-2.jpg"
        },
    ],
    "categories": [
        {
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "href": "/shoes",
            "updatedAt": "2023-11-22T22:55:37Z",
            "menuItemId": "db123901-5646-4061-88d8-bfcb83df21aa",
            "createdAt": "2023-11-22T22:55:37Z",
            "productIds": [],
            "id": "acdc3018-1fb9-4127-9097-f1b8270d87d5",
            "title": "Shoes"
        },
        {
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "href": "/bags",
            "updatedAt": "2023-11-22T22:56:11Z",
            "menuItemId": "db123901-5646-4061-88d8-bfcb83df21aa",
            "createdAt": "2023-11-22T22:56:11Z",
            "productIds": [],
            "id": "5700fd43-1fae-43b4-9201-9b3cde4ef4e2",
            "title": "Bags"
        },
        {
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "href": "/avocado",
            "updatedAt": "2023-12-05T06:28:54Z",
            "menuItemId": "fa930cf7-ac0e-419d-8a78-4701904a4091",
            "createdAt": "2023-12-05T06:28:54Z",
            "productIds": [],
            "id": "4f755e62-6071-457b-8bea-a7b43f15681c",
            "title": "Avoca"
        }
    ],
    "collections": [
        {
            "productType": "physical",
            "published": false,
            "inventory": 50,
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "comparePrice": 0,
            "status": "active",
            "slug": "hair",
            "createdAt": "2023-11-21T13:23:04Z",
            "vendor": "facebook",
            "name": "Hair",
            "isFeatured": false,
            "costPerItem": 0,
            "isContinueSellingOutStock": false,
            "updatedAt": "2023-11-21T13:23:04Z",
            "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
            "description": "This is a simple depo here",
            "price": 29,
            "id": "25333a45-5b26-41a5-9c4f-a886383aa31c",
            "mainImageUrl": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1700572977/facebook/products/whatsapp-image-2023-04-28-at-11.10.17-am-2.jpg"
        },
        {
            "categoryIds": [],
            "productType": "physical",
            "published": false,
            "inventory": 20,
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "comparePrice": 0,
            "status": "active",
            "slug": "pantalon",
            "createdAt": "2023-11-21T13:32:19Z",
            "vendor": "facebook",
            "name": "Pantalon",
            "isFeatured": false,
            "costPerItem": 0,
            "isContinueSellingOutStock": false,
            "updatedAt": "2023-11-21T13:32:19Z",
            "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
            "description": "This is another great demo",
            "price": 49,
            "id": "999f182d-8547-4c47-a4ee-6d3d83598924",
            "mainImageUrl": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1700573529/facebook/products/whatsapp-image-2023-04-28-at-11.10.17-am-3.jpg"
        }
    ]
}
```

{% endtab %}

{% tab title="404: Not Found Not found" %}

```javascript
{
    "message": "Shop with id a0f30628-1ff7-41d8-8392-7c703066e66c not found",
    "status": 404
}
```

{% endtab %}

{% tab title="429: Too Many Requests Too many requests" %}

```javascript
{
    "message": "Too many requests, please try again later.",
    "status": 429
}
```

{% endtab %}
{% endtabs %}

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

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

let config = {
  method: 'get',
  url: 'https://sandbox.pgecom.com/api/v1/storefront/shop/0a40d129-0728-4b10-b32e-117abd6938c3',
  headers: { }
};

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/v1/storefront/shop/0a40d129-0728-4b10-b32e-117abd6938c3"

payload = {}
headers = {}

response = requests.request("GET", 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/v1/storefront/shop/0a40d129-0728-4b10-b32e-117abd6938c3")

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

request = Net::HTTP::Get.new(url)

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/v1/storefront/shop/0a40d129-0728-4b10-b32e-117abd6938c3');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
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" %}

```javascript
curl --location 'https://sandbox.pgecom.com/api/v1/storefront/shop/0a40d129-0728-4b10-b32e-117abd6938c3'
```

{% endtab %}
{% endtabs %}


# CreateShop

Use this endpoint to create a shop

## Get shop details by shop id

<mark style="color:blue;">`Post`</mark> `https://sandbox.pgecom.com/api/v1/shop`

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

```json
{
    "id": "0a40d129-0728-4b10-b32e-117abd6938c3",
    "theme": "default",
    "user": {
        "id": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
        "email": "info@pgecom.com",
        "phone": "+14048253444",
        "avatar": "https://pgecom-staging.s3.amazonaws.com/c5400b13-c8de-4cb2-bc12-f4850958169f-profile.png",
        "verified": true,
        "name": {
            "firstName": "Esterling",
            "lastName": "Accime"
        }
    },
    "email": "info@pgecom.com",
    "name": "facebook",
    "phone": "+1 404 825 3444",
    "merchantId": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "description": "Testing and testing",
    "verified": true,
    "paymentMethods": [
        "stripe"
    ],
    "coverPicture": null,
    "headerColorHex": "#e1e3fd",
    "footerColorHex": "#f7a1f3",
    "primaryColorHex": "#95f695",
    "secondaryColorHex": "#fffcfc",
    "crispWebsiteId": "1b38e124-7b98-4652-9599-b45ff96e5e4c",
    "profilePicture": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1701756145/5f56dfa3-a415-4818-8275-44fc63ece3fd/facebook/logo/image.png",
    "socialLinks": {
        "facebook": null,
        "youtube": null,
        "twitter": null,
        "instagram": null
    },
    "products": [
        {
            "productType": "physical",
            "published": false,
            "inventory": 50,
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "comparePrice": 0,
            "status": "draft",
            "slug": "hair",
            "createdAt": "2023-11-21T13:23:04Z",
            "vendor": "facebook",
            "name": "Hair",
            "isFeatured": false,
            "costPerItem": 0,
            "isContinueSellingOutStock": false,
            "updatedAt": "2023-11-21T13:23:04Z",
            "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
            "description": "This is a simple depo here",
            "price": 29,
            "id": "25333a45-5b26-41a5-9c4f-a886383aa31c",
            "mainImageUrl": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1700572977/facebook/products/whatsapp-image-2023-04-28-at-11.10.17-am-2.jpg"
        },
    ],
    "categories": [
        {
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "href": "/shoes",
            "updatedAt": "2023-11-22T22:55:37Z",
            "menuItemId": "db123901-5646-4061-88d8-bfcb83df21aa",
            "createdAt": "2023-11-22T22:55:37Z",
            "productIds": [],
            "id": "acdc3018-1fb9-4127-9097-f1b8270d87d5",
            "title": "Shoes"
        },
        {
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "href": "/bags",
            "updatedAt": "2023-11-22T22:56:11Z",
            "menuItemId": "db123901-5646-4061-88d8-bfcb83df21aa",
            "createdAt": "2023-11-22T22:56:11Z",
            "productIds": [],
            "id": "5700fd43-1fae-43b4-9201-9b3cde4ef4e2",
            "title": "Bags"
        },
        {
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "href": "/avocado",
            "updatedAt": "2023-12-05T06:28:54Z",
            "menuItemId": "fa930cf7-ac0e-419d-8a78-4701904a4091",
            "createdAt": "2023-12-05T06:28:54Z",
            "productIds": [],
            "id": "4f755e62-6071-457b-8bea-a7b43f15681c",
            "title": "Avoca"
        }
    ],
    "collections": [
        {
            "productType": "physical",
            "published": false,
            "inventory": 50,
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "comparePrice": 0,
            "status": "active",
            "slug": "hair",
            "createdAt": "2023-11-21T13:23:04Z",
            "vendor": "facebook",
            "name": "Hair",
            "isFeatured": false,
            "costPerItem": 0,
            "isContinueSellingOutStock": false,
            "updatedAt": "2023-11-21T13:23:04Z",
            "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
            "description": "This is a simple depo here",
            "price": 29,
            "id": "25333a45-5b26-41a5-9c4f-a886383aa31c",
            "mainImageUrl": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1700572977/facebook/products/whatsapp-image-2023-04-28-at-11.10.17-am-2.jpg"
        },
        {
            "categoryIds": [],
            "productType": "physical",
            "published": false,
            "inventory": 20,
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "comparePrice": 0,
            "status": "active",
            "slug": "pantalon",
            "createdAt": "2023-11-21T13:32:19Z",
            "vendor": "facebook",
            "name": "Pantalon",
            "isFeatured": false,
            "costPerItem": 0,
            "isContinueSellingOutStock": false,
            "updatedAt": "2023-11-21T13:32:19Z",
            "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
            "description": "This is another great demo",
            "price": 49,
            "id": "999f182d-8547-4c47-a4ee-6d3d83598924",
            "mainImageUrl": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1700573529/facebook/products/whatsapp-image-2023-04-28-at-11.10.17-am-3.jpg"
        }
    ]
}
```

{% endtab %}

{% tab title="404: Not Found Not found" %}

```javascript
{
    "message": "Shop with id a0f30628-1ff7-41d8-8392-7c703066e66c not found",
    "status": 404
}
```

{% endtab %}

{% tab title="429: Too Many Requests Too many requests" %}

```javascript
{
    "message": "Too many requests, please try again later.",
    "status": 429
}
```

{% endtab %}
{% endtabs %}

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

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

let config = {
  method: 'get',
  url: 'https://sandbox.pgecom.com/api/v1/storefront/shop/0a40d129-0728-4b10-b32e-117abd6938c3',
  headers: { }
};

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/v1/storefront/shop/0a40d129-0728-4b10-b32e-117abd6938c3"

payload = {}
headers = {}

response = requests.request("GET", 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/v1/storefront/shop/0a40d129-0728-4b10-b32e-117abd6938c3")

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

request = Net::HTTP::Get.new(url)

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/v1/storefront/shop/0a40d129-0728-4b10-b32e-117abd6938c3');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
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" %}

```javascript
curl --location 'https://sandbox.pgecom.com/api/v1/storefront/shop/0a40d129-0728-4b10-b32e-117abd6938c3'
```

{% endtab %}
{% endtabs %}


# Product

Unlock the full potential of your e-commerce experience by harnessing the robust features of the PGecom platform.

With this innovative tool, you gain the ability to not only create a diverse range of products complete with variants but also curate collections that resonate with your target audience.

The intuitive interface simplifies the categorization process, allowing you to seamlessly organize and present your offerings within your online store.

Furthermore, as your business evolves and grows, the PGecom platform offers you the flexibility to expand your reach. Diversify your sales strategy by effortlessly listing your products in various categories, ensuring they are prominently showcased in your store.

Embrace the opportunity to extend your presence beyond the confines of a single channel, as the platform enables you to seamlessly sell your products across different channels.

This adaptability empowers you to tap into new markets and connect with a broader audience, driving the success and scalability of your online business.

Experience the convenience and versatility of PGecom as you navigate the dynamic landscape of e-commerce.


# ProductSchema

The Product schema lets you update and create products in a merchant's store. You can use product variants with the Product resource to create or update different versions of the same product.

`id - string`

The unique identifier of the product

***

`name - string`

The name of the product

***

`status - string`

The status of the product. There are currently 3 statuses for a product

* **active** - visible to the consumer
* **draft**  - still in construction
* **archived** - no longer needed

***

`slug - string`

Slug will be automatically generated for you based on the name of the product and can be used later to find products by a given slug

***

`published - boolean`

Whether or not you want the product to be published in our marketplace

***

`vendor - string`

The name of the shop that owns this product

***

`inventory - number`

The number of products that are available for purchase

***

`price - number`

The price of this product

***

`comparePrice - number`

The discounted price of the product

***

`description - string`

The description of the product

***

`productType - string`

The type of the product. We currently support 3 types of products

* **physical**
* **digital**
* **service**

***

`costPerItem - number`

The cost you purchasing the product

***

`sku - string`

The SKU of the product

***

`collections - array`

A list of collections that this product belongs to

***

`variants - array`

A list of variants available for this product

***

`images - array`

A list of images available for this product

***

`categories - array`

The list of categories available for this product

***

`createdAt - string`

The date the product was created

***

`updatedAt - string`

The last time that the product was updated


# GetProductById

This endpoint is there to get product by id

You'll need to replace the {{productId}} with the actual productId to fetch the API

<mark style="color:blue;">`GET`</mark> `https://sandbox.pgecom.com/api/v1/product/{{productId}}`

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

````json
{
    "id": "b72b1e68-bb0d-48c2-ab85-ed0d24b7adfd",
    "slug": "hair",
    "shop": {
        "id": "9c4e8c79-b901-4b71-a305-0374664a0b65",
        "user": {
            "id": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
            "email": "info@pgecom.com",
            "phone": "+14048253444",
            "avatar": "https://pgecom-staging.s3.amazonaws.com/c5400b13-c8de-4cb2-bc12-f4850958169f-profile.png",
            "verified": true,
            "name": {
                "firstName": "Esterling",
                "lastName": "Accime"
            }
        },
        "name": "pgecom",
        "merchantId": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
        "verified": true,
        "coverPicture": null,
        "crispWebsiteId": null,
        "socialLinks": {
            "facebook": null,
            "youtube": null,
            "twitter": null,
            "instagram": null
        }
    },
    "title": "Hair",
    "brand": "pgecom",
    "price": 50,
    "merchant": {
        "id": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
        "email": "info@pgecom.com",
        "phone": "+14048253444",
        "avatar": "https://pgecom-staging.s3.amazonaws.com/c5400b13-c8de-4cb2-bc12-f4850958169f-profile.png",
        "verified": true,
        "firstName": "Esterling",
        "lastName": "Accime",
        "name": {
            "firstName": "Esterling",
            "lastName": "Accime"
        }
    },
    "merchantId": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "size": null,
    "colors": [],
    "comparePrice": 0,
    "mainImageUrl": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1699063414/5f56dfa3-a415-4818-8275-44fc63ece3fd/pgecom/products/ebd7830c-f4aa-43fa-aeb4-ef2fedc4569e.jpg",
    "images": [
        {
            "size": 85113,
            "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
            "altText": "binance_to_moncash.jpeg",
            "updatedAt": "2023-11-04T02:03:34Z",
            "createdAt": "2023-11-04T02:03:34Z",
            "publicId": "ebd7830c-f4aa-43fa-aeb4-ef2fedc4569e",
            "url": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1699063414/5f56dfa3-a415-4818-8275-44fc63ece3fd/pgecom/products/ebd7830c-f4aa-43fa-aeb4-ef2fedc4569e.jpg",
            "key": "515680fa0498fe1ed7d66f300",
            "id": "ebd7830c-f4aa-43fa-aeb4-ef2fedc4569e",
            "name": "binance_to_moncash.jpeg",
            "productId": "b72b1e68-bb0d-48c2-ab85-ed0d24b7adfd"
        },
        {
            "size": 98651,
            "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
            "altText": "binance_to_moncash_lady.jpeg",
            "updatedAt": "2023-11-04T02:03:30Z",
            "createdAt": "2023-11-04T02:03:30Z",
            "publicId": "b34ba0a2-ba34-4f1b-a51b-2706f97a72ca",
            "url": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1699063410/5f56dfa3-a415-4818-8275-44fc63ece3fd/pgecom/products/b34ba0a2-ba34-4f1b-a51b-2706f97a72ca.jpg",
            "key": "85a3c490b2ceaf6d5f1057b00",
            "id": "b34ba0a2-ba34-4f1b-a51b-2706f97a72ca",
            "name": "binance_to_moncash_lady.jpeg",
            "productId": "b72b1e68-bb0d-48c2-ab85-ed0d24b7adfd"
        },
        {
            "size": 85005,
            "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
            "altText": "venmo_to_moncash.jpeg",
            "updatedAt": "2023-11-04T02:03:34Z",
            "createdAt": "2023-11-04T02:03:34Z",
            "publicId": "a2bca0e2-1031-425c-9e34-2a205bfa0336",
            "url": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1699063413/5f56dfa3-a415-4818-8275-44fc63ece3fd/pgecom/products/a2bca0e2-1031-425c-9e34-2a205bfa0336.jpg",
            "key": "92375e5a2ea2b105235505c00",
            "id": "a2bca0e2-1031-425c-9e34-2a205bfa0336",
            "name": "venmo_to_moncash.jpeg",
            "productId": "b72b1e68-bb0d-48c2-ab85-ed0d24b7adfd"
        },
        {
            "size": 85395,
            "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
            "altText": "cashapp_to_moncash.jpeg",
            "updatedAt": "2023-11-04T02:03:31Z",
            "createdAt": "2023-11-04T02:03:31Z",
            "publicId": "bf0a57c7-d8a4-4f26-adb3-7da7ae89ae4b",
            "url": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1699063410/5f56dfa3-a415-4818-8275-44fc63ece3fd/pgecom/products/bf0a57c7-d8a4-4f26-adb3-7da7ae89ae4b.jpg",
            "key": "feb3448de71fb0e3b39028e00",
            "id": "bf0a57c7-d8a4-4f26-adb3-7da7ae89ae4b",
            "name": "cashapp_to_moncash.jpeg",
            "productId": "b72b1e68-bb0d-48c2-ab85-ed0d24b7adfd"
        },
        {
            "size": 80314,
            "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
            "altText": "zelle_to_moncash.jpeg",
            "updatedAt": "2023-11-04T02:03:30Z",
            "createdAt": "2023-11-04T02:03:30Z",
            "publicId": "1aedd050-2518-4f34-b225-fc1cfc7f45ec",
            "url": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1699063410/5f56dfa3-a415-4818-8275-44fc63ece3fd/pgecom/products/1aedd050-2518-4f34-b225-fc1cfc7f45ec.jpg",
            "key": "d15c83ecd0393d676a3737200",
            "id": "1aedd050-2518-4f34-b225-fc1cfc7f45ec",
            "name": "zelle_to_moncash.jpeg",
            "productId": "b72b1e68-bb0d-48c2-ab85-ed0d24b7adfd"
        }
    ],
    "categories": [],
    "status": "active",
    "reviews": [],
    "variants": [],
    "for": {
        "demo": "market-1",
        "type": "flash-deals"
    },
    "description": "Hair Product",
    "inventory": 20
}
```
````

{% endtab %}

{% tab title="404: Not Found Not found" %}

```json
{
    "message": "Product with id b72b1e68-bb0d-48c2-ab85-ed0d24b7adf not found",
    "status": 404
}
```

{% endtab %}

{% tab title="429: Too Many Requests Too many request" %}

```json
{
    "message": "Too many requests, please try again later.",
    "status": 429
}
```

{% endtab %}
{% endtabs %}

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

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

let config = {
  method: 'get',
  url: 'https://sandbox.pgecom.com/api/v1/storefront/product/b72b1e68-bb0d-48c2-ab85-ed0d24b7adfd',
  headers: { }
};

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

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "http://localhost:3002/api/v1/storefront/product/b72b1e68-bb0d-48c2-ab85-ed0d24b7adfd"

payload = {}
headers = {}

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

print(response.text)

```

{% endtab %}

{% tab title="Ruby" %}

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

url = URI("http://localhost:3002/api/v1/storefront/product/b72b1e68-bb0d-48c2-ab85-ed0d24b7adfd")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)

response = http.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/v1/storefront/product/b72b1e68-bb0d-48c2-ab85-ed0d24b7adfd');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
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" %}

```javascript
curl --location 'http://localhost:3002/api/v1/storefront/product/b72b1e68-bb0d-48c2-ab85-ed0d24b7adfd'
```

{% endtab %}
{% endtabs %}


# GetProductBySlug

This endpoint is there to get product by slug name

In the example below, slug is set for the name for the product slug

<mark style="color:blue;">`GET`</mark> `https://sandbox.pgecom.com/api/v1/product/slug/{{slug}}`

#### Query Parameters

| Name                                     | Type   | Description     |
| ---------------------------------------- | ------ | --------------- |
| shopId<mark style="color:red;">\*</mark> | String | product shop id |

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

```json
[
    {
        "productType": "service",
        "published": false,
        "inventory": 20,
        "shopId": "9c4e8c79-b901-4b71-a305-0374664a0b65",
        "comparePrice": 0,
        "status": "active",
        "slug": "hair",
        "createdAt": "2023-11-04T02:04:51Z",
        "vendor": "pgecom",
        "name": "Hair",
        "isFeatured": false,
        "costPerItem": 0,
        "isContinueSellingOutStock": false,
        "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
        "updatedAt": "2023-11-04T02:04:51Z",
        "description": "Hair Product",
        "price": 50,
        "id": "b72b1e68-bb0d-48c2-ab85-ed0d24b7adfd",
        "mainImageUrl": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1699063414/5f56dfa3-a415-4818-8275-44fc63ece3fd/pgecom/products/ebd7830c-f4aa-43fa-aeb4-ef2fedc4569e.jpg"
    }
]
```

{% endtab %}

{% tab title="500: Internal Server Error Internal Server Error" %}

```
{
    "message": "\"shopId\" is required",
    "status": 500
}
```

{% endtab %}

{% tab title="429: Too Many Requests Too many request" %}

```json
{
    "message": "Too many requests, please try again later.",
    "status": 429
}

```

{% endtab %}

{% tab title="404: Not Found Not found" %}

```
{
    "message": "Products with slug id hai not found",
    "status": 404
}
```

{% endtab %}
{% endtabs %}

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

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

let config = {
  method: 'get',
  url: 'https://sandbox.pgecom.com/api/v1/storefront/product/slug/hair?shopId=9c4e8c79-b901-4b71-a305-0374664a0b65',
  headers: { }
};

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

```

{% endtab %}

{% tab title="Python" %}

```python
import http.client

conn = http.client.HTTPSConnection("localhost", 3002)
payload = ''
headers = {}
conn.request("GET", "/api/v1/storefront/product/slug/hair?shopId=9c4e8c79-b901-4b71-a305-0374664a0b65", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

{% endtab %}

{% tab title="Ruby" %}

```php
require "uri"
require "net/http"

url = URI("http://localhost:3002/api/v1/storefront/product/slug/hair?shopId=9c4e8c79-b901-4b71-a305-0374664a0b65")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('http://localhost:3002/api/v1/storefront/product/slug/hair?shopId=9c4e8c79-b901-4b71-a305-0374664a0b65');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
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" %}

```
curl --location 'http://localhost:3002/api/v1/storefront/product/b72b1e68-bb0d-48c2-ab85-ed0d24b7adfd'
```

{% endtab %}
{% endtabs %}


# CreateNewProduct

This endpoint is there to create new product

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

#### Headers

| Name                                            | Type   | Description      |
| ----------------------------------------------- | ------ | ---------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer {{token}} |

#### Request Body

| Name                                          | Type   | Description                                   |
| --------------------------------------------- | ------ | --------------------------------------------- |
| shopId<mark style="color:red;">\*</mark>      | String | The id of the shop                            |
| name<mark style="color:red;">\*</mark>        | String | Name of the product                           |
| price<mark style="color:red;">\*</mark>       | Number | The current price of the product              |
| description<mark style="color:red;">\*</mark> | String | Product description                           |
| mainImageUrl                                  | String | The main image url                            |
| comparePrice                                  | Number | Discount price of the product                 |
| costPerItem                                   | Number | The amount of cost per item                   |
| inventory                                     | Number | Quantity of products in stock                 |
| productType                                   | String | Type of products (physical, digital, service) |
| status                                        | String | Product status (draft, active, archived)      |

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

```json
{
    "name": "Hair",
    "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
    "description": "This is another fantastic product. I am looking forward to doing it here",
    "price": 50,
    "productType": "digital",
    "comparePrice": 0,
    "inventory": 20,
    "costPerItem": 0,
    "status": "draft",
    "mainImageUrl": "",
    "id": "0ee6defd-2210-47f6-b624-07f79396ca2a",
    "slug": "hair",
    "isFeatured": false,
    "isContinueSellingOutStock": false,
    "published": false,
    "vendor": "facebook",
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Internal Server Error" %}

```json
{
    "message": "\"shopId\" is required",
    "status": 500
}
```

{% endtab %}

{% tab title="429: Too Many Requests Too many request" %}

```json
{
    "message": "Too many requests, please try again later.",
    "status": 429
}

```

{% endtab %}

{% tab title="401: Unauthorized Unauthorized" %}

```json
{
    "message": "Token needs to be provided",
    "status": 401
}
```

{% endtab %}

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

```json

{
    "message": "Shop with id 0a40d129-0728-b10-b32e-117abd6938c3 not found"
}
```

{% endtab %}
{% endtabs %}

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

```javascript
const axios = require('axios');
let data = {
    "name": "Hair",
    "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
    "description": "This is another fantastic product. I am looking forward to doing it here",
    "id": "aa97f0b3-c13d-437d-8d06-d46f0f65a48b",
    "price": "50",
    "productType": "digital",
    "comparePrice": 0,
    "inventory": "20",
    "costPerItem": 0,
    "status": "draft",
    "mainImageUrl": ""
}
let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://sandbox.pgecom.com/api/v1/merchant/product',
  headers: { },
  data : data
};

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

```

{% endtab %}

{% tab title="Python" %}

```python
import http.client

conn = http.client.HTTPSConnection("https://sandbox.pgecom.com")
payload = {
    "name": "Hair",
    "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
    "description": "This is another fantastic product. I am looking forward to doing it here",
    "id": "aa97f0b3-c13d-437d-8d06-d46f0f65a48b",
    "price": "50",
    "productType": "digital",
    "comparePrice": 0,
    "inventory": "20",
    "costPerItem": 0,
    "status": "draft",
    "mainImageUrl": ""
}
headers = {}
conn.request("POST", "/api/v1/merchant/product", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

{% endtab %}

{% tab title="Ruby" %}

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

url = URI("https://sandbox.pgecom.com/api/v1/merchant/product")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request.body = {
    "name": "Hair",
    "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
    "description": "This is another fantastic product. I am looking forward to doing it here",
    "id": "aa97f0b3-c13d-437d-8d06-d46f0f65a48b",
    "price": "50",
    "productType": "digital",
    "comparePrice": 0,
    "inventory": "20",
    "costPerItem": 0,
    "status": "draft",
    "mainImageUrl": ""
}
response = http.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/v1/merchant/product');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setBody({
    "name": "Hair",
    "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
    "description": "This is another fantastic product. I am looking forward to doing it here",
    "id": "aa97f0b3-c13d-437d-8d06-d46f0f65a48b",
    "price": "50",
    "productType": "digital",
    "comparePrice": 0,
    "inventory": "20",
    "costPerItem": 0,
    "status": "draft",
    "mainImageUrl": ""
})
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" %}

```
curl --location 'https://sandbox.pgecom.com/api/v1/merchant/product' \
--data '{
    "name": "Hair",
    "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
    "description": "This is another fantastic product. I am looking forward to doing it here",
    "price": "50",
    "productType": "digital",
    "comparePrice": 0,
    "inventory": "20",
    "costPerItem": 0,
    "status": "draft",
    "mainImageUrl": ""
}'
```

{% endtab %}
{% endtabs %}


# Collection

Collections offer a structured framework for methodically organizing and presenting your products to users.

This powerful feature allows you to curate and showcase related items, creating a cohesive and visually appealing display.

By leveraging collections, you can enhance the user experience, making it easier for customers to explore and discover products that align with their interests.

This organizational tool not only streamlines navigation within your online store but also contributes to a more engaging and tailored shopping experience for your users.


# GetCollectionById

This endpoint is there to get collection by id

You'll need to replace the {{collectionId}} with the actual collection to fetch the API

<mark style="color:blue;">`GET`</mark> `https://sandbox.pgecom.com/api/v1/collection/{{collectionId}}`

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

```json
{
    "searchEngineDescription": "desc",
    "shopId": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "searchEngineTitle": "Page Electronics",
    "updatedAt": "2023-03-03T23:45:25Z",
    "createdAt": "2023-03-03T23:45:25Z",
    "description": "Eletronics gadget",
    "id": "a20e63c3-47e8-489f-a68e-ca4bfdcefd2d",
    "name": "Electronics",
    "mainImageUrl": "https://pg-ecommerce-dev.s3.amazonaws.com/collection/c45ea8cc-7767-46f3-86a7-d9c1f576e715/137c797a75baa78dbbfae7f16ccc653e.jpg",
    "searchEngineUrl": "undefined",
    "products": []
}
```

{% endtab %}

{% tab title="404: Not Found Not found" %}

```json
{
    "message": "Collection with id a20e63c3-47e8-489f-a68e-ca4bfdcefd2 not found",
    "status": 404
}
```

{% endtab %}

{% tab title="429: Too Many Requests Too many request" %}

```json
{
    "message": "Too many requests, please try again later.",
    "status": 429
}
```

{% endtab %}
{% endtabs %}

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

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

let config = {
  method: 'get',
  url: 'https://sandbox.pgecom.com/api/v1/storefront/collection/a20e63c3-47e8-489f-a68e-ca4bfdcefd2',
  headers: { }
};

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/v1/storefront/collection/a20e63c3-47e8-489f-a68e-ca4bfdcefd2"

payload = {}
headers = {}

response = requests.request("GET", 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/v1/storefront/collection/a20e63c3-47e8-489f-a68e-ca4bfdcefd2")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)

response = http.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/v1/storefront/collection/a20e63c3-47e8-489f-a68e-ca4bfdcefd2');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
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" %}

```javascript
curl --location 'https://sandbox.pgecom.com/api/v1/storefront/collection/a20e63c3-47e8-489f-a68e-ca4bfdcefd2
```

{% endtab %}
{% endtabs %}


# Checkout

With this checkout system, you have the capability to initiate a checkout session seamlessly integrating payment options such as MonCash, PGPay, Stripe, and many others.

Utilizing a unified payload approach, you can effortlessly request a checkout URL, streamlining the payment processing for various platforms like MonCash, PGPay, Stripe, and more.

As part of the checkout session, customers are registered within your merchant portal, providing you with a comprehensive overview.

This feature enables you to monitor and track customers in real-time as they progress through the checkout process.

By employing a consistent payload and checkout session mechanism, you ensure a cohesive and efficient payment experience for your customers across multiple payment gateways, enhancing the overall efficiency and management of your online transactions.


# CreateCheckoutSession

This endpoint is there to create a checkout session with redirect url

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

#### Request Body

| Name                       | Type   | Description |
| -------------------------- | ------ | ----------- |
| merchantId                 | String |             |
| shopId                     | String |             |
| paymentMethod              | String |             |
| customer.name              | String |             |
| customer.email             | String |             |
| customer.phone             | String |             |
| shippingAddress.apartment  | String |             |
| shippingAddress.line1      | String |             |
| shippingAddress.city       | String |             |
| shippingAddress.state      | String |             |
| shippingAddress.country    | String |             |
| shippingAddress.postalCode | Number |             |
| billingAddress.apartment   | String |             |
| billingAddress.line1       | String |             |
| billingAddress.city        | String |             |
| billingAddress.state       | String |             |
| billingAddress.country     | String |             |
| billingAddress.postalCode  | Number |             |
| currency                   | String |             |
| products\[0].shopId        | String |             |
| products\[0].quantity      | Number |             |
| products\[0].price         | Number |             |
| products\[0].id            | String |             |
| products\[0].name          | String |             |
| successUrl                 | String |             |
| errorUrl                   | String |             |

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

```json
{
    "message": "Checkout successfully created",
    "customerId": "c2908b96-69d9-4948-b342-25656f7890c8",
    "amount": 148,
    "paymentMethod": "pgpay",
    "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
    "merchantId": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "orderId": "237a3154-fe0a-475a-a0b0-f291c4da597a",
    "products": [
        {
            "productType": "physical",
            "published": false,
            "inventory": 34,
            "shopId": "bf6d4273-3cd4-4319-a349-92e6c089d407",
            "comparePrice": 0,
            "status": "active",
            "slug": "mont",
            "createdAt": "2023-11-05T08:10:19Z",
            "vendor": "tabb nabbers",
            "name": "Mont",
            "isFeatured": false,
            "costPerItem": 0,
            "isContinueSellingOutStock": false,
            "userID": "7d4fd0d8-5da1-4911-8485-1b926c3d4e33",
            "updatedAt": "2023-11-05T08:10:19Z",
            "description": "This is another great demo again",
            "price": 50,
            "id": "fb533bc2-e676-4078-a09a-f286931c2fc6",
            "mainImageUrl": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1699171794/7d4fd0d8-5da1-4911-8485-1b926c3d4e33/tabb%20nabbers/products/19282000-d2e2-4469-884c-5636539e1fe3.jpg",
            "quantity": 1
        },
        {
            "categoryIds": [],
            "productType": "physical",
            "inventory": 20,
            "published": false,
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "comparePrice": 0,
            "status": "active",
            "slug": "pantalon",
            "createdAt": "2023-11-21T13:32:19Z",
            "name": "Pantalon",
            "vendor": "facebook",
            "isFeatured": false,
            "costPerItem": 0,
            "isContinueSellingOutStock": false,
            "updatedAt": "2023-11-21T13:32:19Z",
            "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
            "description": "This is another great demo",
            "id": "999f182d-8547-4c47-a4ee-6d3d83598924",
            "price": 49,
            "mainImageUrl": "https://res.cloudinary.com/dnfoyqynm/image/upload/v1700573529/facebook/products/whatsapp-image-2023-04-28-at-11.10.17-am-3.jpg",
            "quantity": 2
        }
    ],
    "checkoutUrl": "https://www.pgecom.com/payment/pgpay/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySUQiOiI1ZjU2ZGZhMy1hNDE1LTQ4MTgtODI3NS00NGZjNjNlY2UzZmQiLCJhbW91bnQiOjE0OCwicGhvbmUiOiIrMSA0MDQgODI1IDM0NDQiLCJpc1Byb2QiOmZhbHNlLCJvcmRlcklkIjoiMjM3YTMxNTQtZmUwYS00NzVhLWEwYjAtZjI5MWM0ZGE1OTdhIiwicGdQYXlNZXJjaGFudE5hbWUiOiJQR2Vjb20iLCJyZWRpcmVjdFVybCI6IiMiLCJ0cmFuc2FjdGlvblR5cGUiOiJjaGVja291dCIsInF1YW50aXR5IjowLCJjdXN0b21lckVtYWlsIjoiY2hlY2tvdXQiLCJwYXltZW50UHJvdmlkZXIiOiJwZ3BheSIsImlhdCI6MTcwMzc1NzQ2NywiZXhwIjoxNzAzNzYxMDY3fQ.LGVswaaCLT8SlHa8W_uK9--9-QMUFlPqnIHInL2lgR4",
    "totalPrice": 148
}
```

{% endtab %}

{% tab title="500: Internal Server Error Internal Server Error" %}

```
{
    "message": "Provided list of item keys contains duplicates",
    "code": "ValidationException",
    "[__type]": "See error.__type for details.",
    "time": "2023-12-28T09:44:51.347Z",
    "requestId": "020L7BP2USGM6ACA6V69BOR773VV4KQNSO5AEMVJF66Q9ASUAAJG",
    "statusCode": 400,
    "retryable": false,
    "retryDelay": 2.636094949981982
}
```

{% endtab %}

{% tab title="429: Too Many Requests Too many request" %}

```json
{
    "message": "Too many requests, please try again later.",
    "status": 429
}

```

{% endtab %}

{% tab title="404: Not Found Not found" %}

```javascript
{
    "message": "Product ids with 2 not found, please double check the product id"
}
```

{% endtab %}

{% tab title="403: Forbidden Forbidden" %}

```javascript
{
    "message": "Merchant with id 5f56dfa3-a415-4818-8275-44fc63ece3fd is not allowed to checkout"
}
```

{% endtab %}
{% endtabs %}

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

```javascript
const axios = require('axios');
let data = '{\n    "merchantId": "5f56dfa3-a415-4818-8275-44fc63ece3fd",\n    "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",\n    "paymentMethod": "pgpay",\n    "customer": {\n        "name": "Esterling Accime",\n        "email": "accime@pgecom.com",\n        "phone": "+1 404 825 3444"\n    },\n    "shippingAddress": {\n        "apartment": "",\n        "line1": "9700 Medlock Bridge Road",\n        "city": "Johns Creek",\n        "state": "Georgia",\n        "country": "US",\n        "postalCode": 90076\n    },\n    "billingAddress": {\n        "apartment": "",\n        "line1": "9700 Medlock Bridge Road",\n        "city": "Johns Creek",\n        "state": "Georgia",\n        "country": "US",\n        "postalCode": 90076\n    },\n    "products": [\n        {\n            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",\n            "quantity": 2,\n            "price": 49,\n            "id": "999f182d-8547-4c47-a4ee-6d3d83598924",\n            "name": "Demo 1"\n        },\n        {\n            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",\n            "quantity": 1,\n            "price": 29,\n            "id": "fb533bc2-e676-4078-a09a-f286931c2fc6",\n            "name": "Demo 2"\n        }\n    ],\n    "currency": "usd"\n}';

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

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

```

{% endtab %}

{% tab title="Python" %}

```python
import http.client

conn = http.client.HTTPSConnection("https://sandbox.pgecom.com")
payload = ''
headers = {}
conn.request("POST", "/api/v1/checkout", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

{% endtab %}

{% tab title="Ruby" %}

```php
require "uri"
require "net/http"

url = URI("https://sandbox.pgecom.com/api/v1/checkout")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request.body = "{\n    \"merchantId\": \"5f56dfa3-a415-4818-8275-44fc63ece3fd\",\n    \"shopId\": \"0a40d129-0728-4b10-b32e-117abd6938c3\",\n    \"paymentMethod\": \"pgpay\",\n    \"customer\": {\n        \"name\": \"Esterling Accime\",\n        \"email\": \"accime@pgecom.com\",\n        \"phone\": \"+1 404 825 3444\"\n    },\n    \"shippingAddress\": {\n        \"apartment\": \"\",\n        \"line1\": \"9700 Medlock Bridge Road\",\n        \"city\": \"Johns Creek\",\n        \"state\": \"Georgia\",\n        \"country\": \"US\",\n        \"postalCode\": 90076\n    },\n    \"billingAddress\": {\n        \"apartment\": \"\",\n        \"line1\": \"9700 Medlock Bridge Road\",\n        \"city\": \"Johns Creek\",\n        \"state\": \"Georgia\",\n        \"country\": \"US\",\n        \"postalCode\": 90076\n    },\n    \"products\": [\n        {\n            \"shopId\": \"0a40d129-0728-4b10-b32e-117abd6938c3\",\n            \"quantity\": 2,\n            \"price\": 49,\n            \"id\": \"999f182d-8547-4c47-a4ee-6d3d83598924\",\n            \"name\": \"Demo 1\"\n        },\n        {\n            \"shopId\": \"0a40d129-0728-4b10-b32e-117abd6938c3\",\n            \"quantity\": 1,\n            \"price\": 29,\n            \"id\": \"fb533bc2-e676-4078-a09a-f286931c2fc6\",\n            \"name\": \"Demo 2\"\n        }\n    ],\n    \"currency\": \"usd\"\n}"

response = http.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/v1/checkout');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setBody('{\n    "merchantId": "5f56dfa3-a415-4818-8275-44fc63ece3fd",\n    "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",\n    "paymentMethod": "pgpay",\n    "customer": {\n        "name": "Esterling Accime",\n        "email": "accime@pgecom.com",\n        "phone": "+1 404 825 3444"\n    },\n    "shippingAddress": {\n        "apartment": "",\n        "line1": "9700 Medlock Bridge Road",\n        "city": "Johns Creek",\n        "state": "Georgia",\n        "country": "US",\n        "postalCode": 90076\n    },\n    "billingAddress": {\n        "apartment": "",\n        "line1": "9700 Medlock Bridge Road",\n        "city": "Johns Creek",\n        "state": "Georgia",\n        "country": "US",\n        "postalCode": 90076\n    },\n    "products": [\n        {\n            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",\n            "quantity": 2,\n            "price": 49,\n            "id": "999f182d-8547-4c47-a4ee-6d3d83598924",\n            "name": "Demo 1"\n        },\n        {\n            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",\n            "quantity": 1,\n            "price": 29,\n            "id": "fb533bc2-e676-4078-a09a-f286931c2fc6",\n            "name": "Demo 2"\n        }\n    ],\n    "currency": "usd"\n}');
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" %}

```
curl --location 'http://localhost:3002/api/v1/checkout' \
--data-raw '{
    "merchantId": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
    "paymentMethod": "pgpay",
    "customer": {
        "name": "Esterling Accime",
        "email": "accime@pgecom.com",
        "phone": "+1 404 825 3444"
    },
    "shippingAddress": {
        "apartment": "",
        "line1": "9700 Medlock Bridge Road",
        "city": "Johns Creek",
        "state": "Georgia",
        "country": "US",
        "postalCode": 90076
    },
    "billingAddress": {
        "apartment": "",
        "line1": "9700 Medlock Bridge Road",
        "city": "Johns Creek",
        "state": "Georgia",
        "country": "US",
        "postalCode": 90076
    },
    "products": [
        {
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "quantity": 2,
            "price": 49,
            "id": "999f182d-8547-4c47-a4ee-6d3d83598924",
            "name": "Demo 1"
        },
        {
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "quantity": 1,
            "price": 29,
            "id": "fb533bc2-e676-4078-a09a-f286931c2fc6",
            "name": "Demo 2"
        }
    ],
    "currency": "usd"
}'
```

{% endtab %}
{% endtabs %}


# Category

Categories serve as a fundamental organizational tool, enabling you to systematically classify and present your products to users.

This feature empowers you to create distinct groupings based on common themes, characteristics, or attributes, offering a structured and intuitive way for customers to navigate through your diverse product range.

Through the strategic implementation of categories, you can enhance the user's journey by providing a well-defined framework for exploration.

Users can easily locate and browse products within specific themes or genres, facilitating a more seamless and personalized shopping experience.&#x20;

By combining the power of categories with collections, you create a comprehensive system that optimizes product discovery, fostering user engagement and satisfaction within your online store.


# GetCategoryByID

This endpoint is there to get category by id

You'll need to replace the {{categoryId}} with the actual category to fetch the API

<mark style="color:blue;">`GET`</mark> `https://sandbox.pgecom.com/api/v1/category/{{categoryId}}`

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

```json
{
    "href": "/shoes",
    "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
    "updatedAt": "2023-11-22T22:55:37Z",
    "slug": "shoes",
    "createdAt": "2023-11-22T22:55:37Z",
    "menuItemId": "db123901-5646-4061-88d8-bfcb83df21aa",
    "productIds": [],
    "id": "acdc3018-1fb9-4127-9097-f1b8270d87d5",
    "title": "Shoes",
    "subCategories": [
        {
            "href": "/sandal",
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "categoryId": "acdc3018-1fb9-4127-9097-f1b8270d87d5",
            "updatedAt": "2023-11-27T10:31:22Z",
            "createdAt": "2023-11-27T10:31:22Z",
            "id": "9f4bcae6-a199-4adc-80fa-d02234550c86",
            "title": "Sandal"
        }
    ]
}
```

{% endtab %}

{% tab title="404: Not Found Not found" %}

```json
{
    "message": "Category with id acdc3018-1fb9-4127-9097-f1b8270d87d not found",
    "status": 404
}
```

{% endtab %}

{% tab title="429: Too Many Requests Too many request" %}

```json
{
    "message": "Too many requests, please try again later.",
    "status": 429
}
```

{% endtab %}
{% endtabs %}

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

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

let config = {
  method: 'get',
  url: 'https://sandbox.pgecom.com/api/v1/storefront/category/acdc3018-1fb9-4127-9097-f1b8270d87d5',
  headers: { }
};

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/v1/storefront/category/acdc3018-1fb9-4127-9097-f1b8270d87d5"

payload = {}
headers = {}

response = requests.request("GET", 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/v1/storefront/category/acdc3018-1fb9-4127-9097-f1b8270d87d5")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)

response = http.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/v1/storefront/category/acdc3018-1fb9-4127-9097-f1b8270d87d5');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
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" %}

```javascript
curl --location 'https://sandbox.pgecom.com/api/v1/storefront/category/acdc3018-1fb9-4127-9097-f1b8270d87d5'
```

{% endtab %}
{% endtabs %}


# GetCategoryBySlug

This endpoint is there to get category by slug

You'll need to replace the {{slugName}} with the actual category to fetch the API

<mark style="color:blue;">`GET`</mark> `https://sandbox.pgecom.com/api/v1/category/slug/{{slugName}}`

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

```json
[
    {
        "href": "/shoes",
        "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
        "updatedAt": "2023-11-22T22:55:37Z",
        "slug": "shoes",
        "menuItemId": "db123901-5646-4061-88d8-bfcb83df21aa",
        "createdAt": "2023-11-22T22:55:37Z",
        "productIds": [],
        "id": "acdc3018-1fb9-4127-9097-f1b8270d87d5",
        "title": "Shoes"
    }
]
```

{% endtab %}

{% tab title="429: Too Many Requests Too many request" %}

```json
{
    "message": "Too many requests, please try again later.",
    "status": 429
}
```

{% endtab %}
{% endtabs %}

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

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

let config = {
  method: 'get',
  url: 'https://sandbox.pgecom.com/api/v1/storefront/category/slug/shoes?shopId=0a40d129-0728-4b10-b32e-117abd6938c3',
  headers: { }
};

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/v1/storefront/category/slug/shoes?shopId=0a40d129-0728-4b10-b32e-117abd6938c3"

payload = {}
headers = {}

response = requests.request("GET", 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/v1/storefront/category/slug/shoes?shopId=0a40d129-0728-4b10-b32e-117abd6938c3")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)

response = http.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/v1/storefront/category/slug/shoes?shopId=0a40d129-0728-4b10-b32e-117abd6938c3');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
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" %}

```javascript
curl --location 'https://sandbox.pgecom.com/api/v1/storefront/category/slug/shoes?shopId=0a40d129-0728-4b10-b32e-117abd6938c3
```

{% endtab %}
{% endtabs %}


# Form

Categories serve as a fundamental organizational tool, enabling you to systematically classify and present your products to users.

This feature empowers you to create distinct groupings based on common themes, characteristics, or attributes, offering a structured and intuitive way for customers to navigate through your diverse product range.

Through the strategic implementation of categories, you can enhance the user's journey by providing a well-defined framework for exploration.

Users can easily locate and browse products within specific themes or genres, facilitating a more seamless and personalized shopping experience.&#x20;

By combining the power of categories with collections, you create a comprehensive system that optimizes product discovery, fostering user engagement and satisfaction within your online store.


# GetFormById

This endpoint is there to get category by id

You'll need to replace the {{formId}} with the actual form to fetch the API

<mark style="color:blue;">`GET`</mark> `https://sandbox.pgecom.com/api/v1/order-form/{{formId}}`

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

```json
{
    "href": "/shoes",
    "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
    "updatedAt": "2023-11-22T22:55:37Z",
    "slug": "shoes",
    "createdAt": "2023-11-22T22:55:37Z",
    "menuItemId": "db123901-5646-4061-88d8-bfcb83df21aa",
    "productIds": [],
    "id": "acdc3018-1fb9-4127-9097-f1b8270d87d5",
    "title": "Shoes",
    "subCategories": [
        {
            "href": "/sandal",
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "categoryId": "acdc3018-1fb9-4127-9097-f1b8270d87d5",
            "updatedAt": "2023-11-27T10:31:22Z",
            "createdAt": "2023-11-27T10:31:22Z",
            "id": "9f4bcae6-a199-4adc-80fa-d02234550c86",
            "title": "Sandal"
        }
    ]
}
```

{% endtab %}

{% tab title="404: Not Found Not found" %}

```json
{
    "message": "Category with id acdc3018-1fb9-4127-9097-f1b8270d87d not found",
    "status": 404
}
```

{% endtab %}

{% tab title="429: Too Many Requests Too many request" %}

```json
{
    "message": "Too many requests, please try again later.",
    "status": 429
}
```

{% endtab %}
{% endtabs %}

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

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

let config = {
  method: 'get',
  url: 'https://sandbox.pgecom.com/api/v1/storefront/category/acdc3018-1fb9-4127-9097-f1b8270d87d5',
  headers: { }
};

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/v1/storefront/category/acdc3018-1fb9-4127-9097-f1b8270d87d5"

payload = {}
headers = {}

response = requests.request("GET", 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/v1/storefront/category/acdc3018-1fb9-4127-9097-f1b8270d87d5")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)

response = http.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/v1/storefront/category/acdc3018-1fb9-4127-9097-f1b8270d87d5');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
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" %}

```javascript
curl --location 'https://sandbox.pgecom.com/api/v1/storefront/category/acdc3018-1fb9-4127-9097-f1b8270d87d5'
```

{% endtab %}
{% endtabs %}


# Invoice

Categories serve as a fundamental organizational tool, enabling you to systematically classify and present your products to users.

This feature empowers you to create distinct groupings based on common themes, characteristics, or attributes, offering a structured and intuitive way for customers to navigate through your diverse product range.

Through the strategic implementation of categories, you can enhance the user's journey by providing a well-defined framework for exploration.

Users can easily locate and browse products within specific themes or genres, facilitating a more seamless and personalized shopping experience.&#x20;

By combining the power of categories with collections, you create a comprehensive system that optimizes product discovery, fostering user engagement and satisfaction within your online store.


# GetInvoiceById

This endpoint is there to get category by id

You'll need to replace the {{invoiceId}} with the actual invoice to fetch the API

<mark style="color:blue;">`GET`</mark> `https://sandbox.pgecom.com/api/v1/invoice/{{invoiceId}}`

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

```json
{
    "href": "/shoes",
    "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
    "updatedAt": "2023-11-22T22:55:37Z",
    "slug": "shoes",
    "createdAt": "2023-11-22T22:55:37Z",
    "menuItemId": "db123901-5646-4061-88d8-bfcb83df21aa",
    "productIds": [],
    "id": "acdc3018-1fb9-4127-9097-f1b8270d87d5",
    "title": "Shoes",
    "subCategories": [
        {
            "href": "/sandal",
            "shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
            "categoryId": "acdc3018-1fb9-4127-9097-f1b8270d87d5",
            "updatedAt": "2023-11-27T10:31:22Z",
            "createdAt": "2023-11-27T10:31:22Z",
            "id": "9f4bcae6-a199-4adc-80fa-d02234550c86",
            "title": "Sandal"
        }
    ]
}
```

{% endtab %}

{% tab title="404: Not Found Not found" %}

```json
{
    "message": "Category with id acdc3018-1fb9-4127-9097-f1b8270d87d not found",
    "status": 404
}
```

{% endtab %}

{% tab title="429: Too Many Requests Too many request" %}

```json
{
    "message": "Too many requests, please try again later.",
    "status": 429
}
```

{% endtab %}
{% endtabs %}

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

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

let config = {
  method: 'get',
  url: 'https://sandbox.pgecom.com/api/v1/storefront/category/acdc3018-1fb9-4127-9097-f1b8270d87d5',
  headers: { }
};

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/v1/storefront/category/acdc3018-1fb9-4127-9097-f1b8270d87d5"

payload = {}
headers = {}

response = requests.request("GET", 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/v1/storefront/category/acdc3018-1fb9-4127-9097-f1b8270d87d5")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)

response = http.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/v1/storefront/category/acdc3018-1fb9-4127-9097-f1b8270d87d5');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
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" %}

```javascript
curl --location 'https://sandbox.pgecom.com/api/v1/storefront/category/acdc3018-1fb9-4127-9097-f1b8270d87d5'
```

{% endtab %}
{% endtabs %}


# Wordpress Plugin

Please download our PG Pay plugin and install it on your WordPress Website

Please make sure that you have woocommerce plugin install

Once you have woocommerce installed, please download our plugin below and upload it to your WordPress

{% file src="/files/hu6wL0MxhwxF4NCfmVMg" %}

Navigate to your WordPress and click on Plugin

Then in the top left corner, you'll see the option to upload a plugin

Click on the Upload plugin button and upload our zip file into your WordPress

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2F3oVmYcS3uWvmoDr8KyzR%2Fstep_0.jpeg?alt=media&amp;token=4245f6dd-0f89-420e-8798-5e225344fd86" alt=""><figcaption><p>Upload Plugin Button</p></figcaption></figure>

Then WordPress will give you the option to select the files

Click on Choose a file and then click Install now

That should start the plugin installation into your WordPress

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FXKAVpQbNVI9fqfysJe20%2Fstep_1.jpeg?alt=media&amp;token=63961c86-ede1-4b02-ad39-87fe02eff76f" alt=""><figcaption><p>Install Now Plugin Button</p></figcaption></figure>

WordPress will take you to where you can activate the plugin

Then click on the Activate Plugin to activate the plugin

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FhCfh1md81orQswajzWCF%2Fstep_2.jpeg?alt=media&amp;token=9a0005a2-d6f4-4934-b02b-66131bc44e36" alt=""><figcaption><p>Activate Plugin Button</p></figcaption></figure>

To confirm that the plugin is activated successfully, click on the plugins tab

Then search for PG Pay in the list of plugins

You'll see it successfully activate it

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FHiav9oljMFxKbHKfShaM%2Fstep_3.jpeg?alt=media&amp;token=97276864-b73d-4c96-89a7-d1d83e773b70" alt=""><figcaption><p>Activation Confirmation</p></figcaption></figure>

Once the plugin is successfully installed

Navigate to the Woocommerce Settings and click on Payments

You'll see PG Pay as the list of payments

Make sure that it's enabled in your Woocommerce payment

Then click on Save Changes

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2F0iGJabk1ZijaGIE6X6Db%2Fstep_4.jpeg?alt=media&amp;token=d4e4444a-5c26-465f-8570-a694da520612" alt=""><figcaption><p>Enabled PGPay as a payment</p></figcaption></figure>

Once it's enabled, then click on PG Pay

It will take you to the PG Pay settings

You'll need to fill out with the following information

* Enabled/Disable
* Description
* Instructions
* UserID
* UserID Test Mode
* Test Mode

{% hint style="info" %}
To retrieve your UserID you need to navigate to your pgecom.com account

Click on settings and the developer tab
{% endhint %}

Once you've entered all the details, click on Save Changes

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2Fyiwnh8rHNrAnyMsX2ned%2Fstep_5.jpeg?alt=media&amp;token=936b42d1-b238-49d8-8548-0c839eb0b3b4" alt=""><figcaption><p>Fill Out Payment Details</p></figcaption></figure>

Once you've completed that step above

PG Pay is fully integrated into your Woocommerce store

Then navigate to your store and try to purchase a product in your store

Then on the checkout page, you'll see PGPay integrated as an option

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FQELCWDtapHwTl4nIBczV%2Fstep_6.jpeg?alt=media&amp;token=cb450f52-f32f-4b11-8836-f8e2667aafbb" alt=""><figcaption><p>PGPay in the checkout page</p></figcaption></figure>

Once a payment is processed with PGPay

It will redirect the user to the checkout confirmation screen with the correct status

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FSdjopDXIYbBC3DEQFL5r%2Fstep_8.jpeg?alt=media&amp;token=d1aea782-0fe7-4e3f-b3ff-fb8de05133f9" alt=""><figcaption><p>PGPay successfull Payment</p></figcaption></figure>

You'll also be able to see a list of successful payments made in your Woocommerce store

Navigate to your Woocommerce Order page

Then you'll see any order that has been made via PGPay

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FXripJlzeo63B19YslTC0%2Flist_payment.jpeg?alt=media&amp;token=80686b78-228d-4016-bdbf-7296e1c420e9" alt=""><figcaption><p>PGPay list of payments</p></figcaption></figure>

If you click on any of those orders

You'll see more details about the order

Such as order number, products they purchased and how much they paid via PGPay

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2F4L1d1rIgfGcLxHMbstYr%2Fsuccess_payment.jpeg?alt=media&amp;token=ed9a90e0-dfd6-4618-95ec-943029ead26e" alt=""><figcaption><p>Order Details Page</p></figcaption></figure>

I hope you enjoy PGPay as much as we enjoy building it


# Chrome Extension

Please download our PGecom Chrome plugin

{% embed url="<https://youtu.be/G25E1aEwXRs>" %}
PGecom Chrome Extension - 03/05/2024
{% endembed %}

Once you install our extension, you can start purchasing on AliExpress, Shein, and Alibaba with PGPay

{% file src="/files/WrPmBfOxJvphsc6oejBb" %}
pgecom-1.0.1
{% endfile %}

Once you download the file

Navigate to [chrome://extensions](chrome://extensions/) in your browser

Look for **Developer Mode** and make sure that it's on

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2F2TeNguGtPOtkr9DItAg5%2Fstep_1.png?alt=media&amp;token=19e8fd68-4765-4078-92bd-6b73112cb339" alt=""><figcaption><p>Developer Mode</p></figcaption></figure>

Then click on the Load Unpacked button

and upload the unzip that you just downloaded earlier

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FCNUYM11uPy4DMlOgm3AT%2Fstep_2.png?alt=media&amp;token=86574774-9448-4ce1-a372-023d012b6ca2" alt=""><figcaption><p>Load Unpacked FIle</p></figcaption></figure>

If everything was uploaded correctly

You'll view something that looks like this

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FuQQuuhHQPKcf1v7ixznw%2Fstep_3.png?alt=media&amp;token=07db0169-1f8f-4481-9b56-8ce72e49c432" alt=""><figcaption><p>pgecom chrome plugin</p></figcaption></figure>

Once you've confirmed that the extension is installed successfully

You can navigate to AliExpress and you should see something like this

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FfGRJbGoZvj0xsEwiMhGA%2Fstep_4.png?alt=media&amp;token=ca014d2b-986b-4f2f-98f6-f9d55c1892cb" alt=""><figcaption><p>PGecom Payment Method</p></figcaption></figure>


# GiftCards

Accept Mon Cash Payment your customers and receive funds to your PG Rewards account

<details>

<summary>Gift Card Response Example</summary>

````json
```postman_json
[
    {
        "currency": "USD",
        "isPriceFixed": false,
        "giftCardName": "Mastercard® Prepaid Card USD US",
        "brandName": "Mastercard",
        "logoUrl": "https://cdn.reloadly.com/giftcards/e39131b3-1686-4d8a-a95a-78fa2817b9fa.jpeg",
        "maximumAmount": 1000,
        "country": "USA",
        "giftCardId": "16923",
        "redeemptionInstructions": "At the payment site, select a Virtual Prepaid Mastercard, ready for immediate use online or over the phone\\nanywhere Mastercard is accepted. The redemption site will ask you to provide your name, address, email and mobile phone number to be associated with your Prepaid Mastercard. Agree to the Cardholder Agreement to complete the redemption.\\nNOTE: You must select your card within 4 months from the date this email was sent. Your right to the payment expires\\nafter that time. Once redeemed, you will have 12 months to use your Prepaid Mastercard wherever Mastercard is accepted .\\nThe redemption website provides balance information and transaction history to help you keep track of all your rewards.\\ Please note that some merchants may choose not to accept out-of-country currency at their own discretion. If this occurs, pay for your purchase by another payment method and use your Prepaid Mastercard at a different merchant.",
        "providerFee": 0.5,
        "updatedAt": "2023-01-24T07:29:42Z",
        "brandId": "378",
        "id": "d0575a71-83d9-4b15-8eeb-1d08e6450b8f",
        "minimumAmount": 100
    },
    {
        "currency": "USD",
        "isPriceFixed": false,
        "giftCardName": "Netflix United States",
        "brandName": "NetFlix",
        "logoUrl": "https://cdn.reloadly.com/giftcards/netflix-05cItXL96l4LE9n02WfDR0h-5.webp",
        "maximumAmount": 100,
        "country": "USA",
        "giftCardId": "16257",
        "redeemptionInstructions": "To start watching, Go to http://www.netflix.com/code, Enter the code &#13; Valid only towards the Netflix streaming service via Netflix Account (18+ to be a member), in countries where the service is offered in US dollars. &#13; Entire value is credited to your Netflix account upon redemption. &#13; Nonrefundable or redeemable for cash, except where required by law. &#13; Does not expire. No resale.",
        "providerFee": 0.5,
        "updatedAt": "2023-01-24T09:53:25Z",
        "brandId": "41",
        "id": "81b7c4ec-c735-49ee-ab43-3e24721312be",
        "minimumAmount": 15
    },
    {
        "currency": "USD",
        "isPriceFixed": false,
        "giftCardName": "Ebay",
        "brandName": "Ebay",
        "logoUrl": "https://cdn.reloadly.com/giftcards/f23b1e3b-321d-4e9c-8afb-6bc475d82eb2.png",
        "maximumAmount": 100,
        "country": "USA",
        "giftCardId": "1386",
        "redeemptionInstructions": "One Card. So Many Options. That&#39;s exactly what eBay Gift Cards offer the recipient. Whether it's new, unique, or anything in-between, eBay has you covered for any gift, any occasion, and every time! Shop from billions of items in Electronics, Toys, Motors, Fashion, Home & Garden, Art, Collectibles, and many more categories. Best yet, eBay Gift Cards never expire and have no fees. Use it to shop now &#13; During Checkout on eBay.com &#13;1. Enter the 13-digit redemption code, then click Apply. &#13;2.Click Continue to proceed to PayPal. &#13;3.Log into your PayPal account. &#13;4.Review the payment details and click Confirm and Pay. &#13; Treat your eBay Gift Card like cash. Only redeemable to purchase items directly on eBay.com, where PayPal is accepted. To use this Gift Card, you must have a U.S.-registered eBay account, a PayPal account, and a U.S. shipping address. After first use, your eBay Gift Card is non-transferrable. Nonrefundable or redeemable for cash unless required by law. Your eBay Gift Card never expires and there are no fees. &#13; Your eBay Gift Card is subject to full terms and conditions. Redemption limits apply. To check your balance, seek assistance, or read the full terms and conditions visit http://www.ebay.com/ebaygiftcard",
        "providerFee": 0.5,
        "updatedAt": "2023-01-24T09:57:36Z",
        "brandId": "16",
        "id": "1bd0d99a-ae8f-4f55-97b6-98866f699b5b",
        "minimumAmount": 5
    },
    {
        "currency": "USD",
        "isPriceFixed": false,
        "giftCardName": "Uber",
        "brandName": "Uber",
        "logoUrl": "https://cdn.reloadly.com/giftcards/0e7f36f1-7e94-4535-a391-c62f4b1cf279.png",
        "maximumAmount": 100,
        "country": "USA",
        "giftCardId": "13043",
        "redeemptionInstructions": "Go to the Payment section in the Uber app &#13; Tap Add Payment Method and select Gift Card &#13; Enter Gift Code. For full terms and conditions and customer service, visit https://www.uber.com/legal/gift-cards/en-us/",
        "providerFee": 0.5,
        "updatedAt": "2023-01-24T09:54:24Z",
        "brandId": "87",
        "id": "660cfd2b-3e34-45b5-902f-a658de1271a7",
        "minimumAmount": 15
    },
    {
        "currency": "USD",
        "isPriceFixed": false,
        "giftCardName": "Visa® Prepaid Card USD US",
        "brandName": "Visa",
        "logoUrl": "https://cdn.reloadly.com/giftcards/f35131b3-1686-4d8e-a95a-78fa2817b9fa.jpeg",
        "maximumAmount": 100,
        "country": "USA",
        "giftCardId": "16921",
        "redeemptionInstructions": "At the payment site, select a Virtual Visa Card, ready for immediate use online or over the phone anywhere Visa\\ndebit is accepted. The redemption site will ask you to provide your name, address, email, and mobile phone number to be associated with your Prepaid Card. Agree to the Cardholder Agreement to complete the redemption. NOTE: You must select your card within 4 months from the date this email was sent. Your right to the payment expires after that time. Once redeemed, you will have 7 months to use your Visa Prepaid Card wherever Visa debit is accepted. The redemption website provides balance information and transaction history to help you keep track of all your rewards. Please note that some merchants may choose not to accept out-of-country currency at their own discretion. If this occurs, pay for your\\npurchase by another payment method and use your Visa Prepaid Card at a different merchant.",
        "providerFee": 0.5,
        "updatedAt": "2023-01-24T10:00:48Z",
        "brandId": "377",
        "id": "1b0d5ff9-73e4-41c8-8de9-2b85d05e78fe",
        "minimumAmount": 5
    },
    {
        "currency": "USD",
        "isPriceFixed": false,
        "giftCardName": "Binance US",
        "brandName": "Binance",
        "logoUrl": "https://cdn.reloadly.com/giftcards/e9333314-918b-4339-b495-854b7f714376.png",
        "maximumAmount": 100,
        "country": "USA",
        "giftCardId": "16235",
        "redeemptionInstructions": "To redeem, visit https://www.binance.com/en/gift-card or Download the Binance App from https://binance.com/en/download. Create an account, then tap the 'Profile Icon' on the top left corner, tap Gift Card: tap Receive, tap Redeem Crypto, and enter the Gift Card code (16-digit alphanumeric sequence. For more questions, please see Gift Cards FAQ",
        "providerFee": 0.5,
        "updatedAt": "2023-01-24T09:59:04Z",
        "brandId": "320",
        "id": "e548a972-2cd2-40f6-9719-b18391857045",
        "minimumAmount": 50
    },
    {
        "currency": "USD",
        "isPriceFixed": false,
        "giftCardName": "Amazon US",
        "brandName": "Amazon",
        "logoUrl": "https://cdn.reloadly.com/giftcards/fbef9b57-e0b0-4ead-aee3-fdc2bc80e2db.png",
        "maximumAmount": 100,
        "country": "USA",
        "giftCardId": "5",
        "redeemptionInstructions": "Amazon.com Gift Cards never expire and can be redeemed towards millions of items at www.amazon.com &#13; To redeem your gift card, follow these steps: &#13;1. Visit www.amazon.com/redeem &#13;2. Enter the Claim Code when prompted. &#13;3. Gift card funds will be applied automatically to eligible orders during the checkout process. &#13;4. You must pay for any remaining balance on your order with another payment method. &#13; Your gift card claim code may also be entered when prompted during checkout. To redeem your gift card using the Amazon.com service, first, add the gift card funds to Your Account. If you have questions about redeeming your gift card, please visit www.amazon.com/gc-redeem",
        "providerFee": 0.5,
        "updatedAt": "2023-01-24T09:55:39Z",
        "brandId": "2",
        "id": "7d4ffc9e-de33-4d02-ac7f-7ad9488489d9",
        "minimumAmount": 15
    }
]
```
````

</details>


# Gift Card Schema

<table><thead><tr><th width="255">Property</th><th width="146">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>providerId</code></td><td>String</td><td>The provider id from the gift card list</td></tr><tr><td><code>type</code></td><td>String</td><td><p>The type of gift card</p><p>(ex. Netflix, Apple, Free Fire, etc)</p></td></tr><tr><td><code>isActivated</code></td><td>Boolean</td><td>This flag is set to let partner know if the gift card is active/inactive or not. If the flag is set to false, no order can be placed</td></tr><tr><td><code>platform</code></td><td>String</td><td><p>The platform issuing the gift cards </p><p>(ex. pgecom)</p></td></tr><tr><td><code>minimum</code></td><td>Number</td><td>The minimum amount to purchase from gift card</td></tr><tr><td><code>maximum</code></td><td>Number</td><td>The maximum amount for gift cards</td></tr><tr><td><code>defaultDelivery</code></td><td></td><td>The default delivery that's available</td></tr><tr><td><code>displayName</code></td><td>String</td><td><p>The display name of the gift card</p><p>(ex. Apple, Netflix)</p></td></tr><tr><td><code>image</code></td><td>String</td><td>The image of the gift card</td></tr><tr><td><code>provider</code></td><td>String</td><td><p>The provider that issue this gift card </p><p>(ex. pgecom)</p></td></tr><tr><td><code>providerId</code></td><td>String</td><td><p>The id of the gift card from provider</p><p>(ex. 5, 21, 247, etc)</p></td></tr><tr><td><code>id</code></td><td>String</td><td>This is the id that you'll need  in order to place an order for the gift card</td></tr><tr><td><code>feePercentage</code></td><td>Number</td><td>This is a default fee percentage if those options are not set (ex. standard, regular, express, urgent or instant)</td></tr><tr><td><code>fixedFee</code></td><td>Number</td><td>Certain provider charged a fixed fee for the gift card. This applies to the gift card fees calculation</td></tr><tr><td><code>standardDeliveryFee</code></td><td>Number</td><td>Delivery percentage fee. This applies into the fee calculation</td></tr><tr><td><code>regularDeliveryFee</code></td><td>Number</td><td>Delivery percentage fee. This applies into the fee calculation</td></tr><tr><td><code>expressDeliveryFee</code></td><td>Number</td><td>Delivery percentage fee. This applies into the fee calculation</td></tr><tr><td><code>urgentDeliveryFee</code></td><td>Number</td><td>Delivery percentage fee. This applies into the fee calculation</td></tr><tr><td><code>instantDeliveryFee</code></td><td>Number</td><td>Delivery percentage fee. This applies into the fee calculation</td></tr><tr><td><code>isPriceFixed</code></td><td>Boolean</td><td>Certain gift cards only have fixed price available</td></tr><tr><td><code>isStandardDelivery</code></td><td>Boolean</td><td>Flag for 2 business days delivery. When this flag is enabled, that means that this delivery method is enabled</td></tr><tr><td><code>isRegularDelivery</code></td><td>Boolean</td><td>Flag for 1 business days delivery. When this flag is enabled, that means that this delivery method is enabled</td></tr><tr><td><code>isExpressDelivery</code></td><td>Boolean</td><td>Flag for 2 business days delivery. When this flag is enabled, that means that this delivery method is enabled</td></tr><tr><td><code>isUrgentDelivery</code></td><td>Boolean</td><td>Flag for 30 business days delivery. When this flag is enabled, that means that this delivery method is enabled</td></tr><tr><td><code>isInstantDelivery</code></td><td>Boolean</td><td>Flag for 2 minutes delivery. When this flag is enabled, that means that this delivery method is enabled</td></tr><tr><td><code>createdAt</code></td><td>String</td><td>The date that the gift card was created in our system</td></tr><tr><td><code>updatedAt</code></td><td>String</td><td>The date that it was last updated</td></tr></tbody></table>


# List giftcards

## Retrieve all gift cards

<mark style="color:blue;">`GET`</mark> `https://sandbox.pgecom.com/api/v1/giftcards`

#### Headers

| Name          | Type   | Description    |
| ------------- | ------ | -------------- |
| authorization | String | Bearer `token` |

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

```json
[
    {
        "standardDeliveryFee": 5,
        "maximum": 1000,
        "isRegularDelivery": true,
        "createdAt": "2024-05-09T00:57:03.904Z",
        "defaultDelivery": "express",
        "isExpressDelivery": true,
        "regularDeliveryFee": 7,
        "expressDeliveryFee": 9,
        "displayName": "Visa",
        "providerId": "18598",
        "image": "https://cdn.pgecom.com/giftcards/aa1431b0-99fe-4f3d-8c58-ef46baee0c00.png",
        "platform": "pgrewards",
        "updatedAt": "2024-05-20T15:58:19.571Z",
        "urgentDeliveryFee": 12,
        "minimum": 5,
        "provider": "pgecom",
        "isActivated": false,
        "isStandardDelivery": true,
        "id": "e91cde79-7ab8-4c4e-888f-6a4bff03def4",
        "feePercentage": 8,
        "fixedFee": 1.5,
        "isUrgentDelivery": false,
        "type": "visa"
    },
    {
        "maximum": 100,
        "defaultDelivery": "instant",
        "expressDeliveryFee": 7,
        "displayName": "Amazon",
        "image": "https://cdn.pgecom.com/giftcards/fbef9b57-e0b0-4ead-aee3-fdc2bc80e2db.png",
        "provider": "pgecom",
        "isStandardDelivery": false,
        "id": "aebfb2c8-7a57-4d07-9880-39569245fa00",
        "feePercentage": 8,
        "fixedFee": 1.5,
        "isUrgentDelivery": false,
        "instantDeliveryFee": 9,
        "standardDeliveryFee": 3,
        "isPriceFixed": false,
        "isRegularDelivery": false,
        "createdAt": "2024-05-09T01:29:24.387Z",
        "isExpressDelivery": false,
        "regularDeliveryFee": 5,
        "isInstantDelivery": true,
        "providerId": "5",
        "platform": "pgrewards",
        "updatedAt": "2024-06-01T03:23:27.952Z",
        "urgentDeliveryFee": 9,
        "minimum": 5,
        "isActivated": true,
        "type": "amazon"
    },
    {
        "maximum": 50,
        "defaultDelivery": "instant",
        "expressDeliveryFee": 9,
        "displayName": "Netflix",
        "image": "https://cdn.pgecom.com/giftcards/netflix-05cItXL96l4LE9n02WfDR0h-5.webp",
        "provider": "pgecom",
        "isStandardDelivery": false,
        "id": "051b4e62-cd1e-4780-8a58-76704416636c",
        "feePercentage": 3,
        "fixedFee": 0.5,
        "isUrgentDelivery": false,
        "instantDeliveryFee": 5,
        "standardDeliveryFee": 5,
        "isPriceFixed": true,
        "isRegularDelivery": false,
        "createdAt": "2024-05-02T13:49:26.099Z",
        "isExpressDelivery": false,
        "regularDeliveryFee": 7,
        "isInstantDelivery": true,
        "providerId": "16257",
        "platform": "pgrewards",
        "updatedAt": "2024-06-01T01:02:46.307Z",
        "urgentDeliveryFee": 12,
        "minimum": 15,
        "isActivated": true,
        "type": "netflix"
    },
    {
        "maximum": 1000,
        "defaultDelivery": "instant",
        "expressDeliveryFee": 9,
        "displayName": "Ebay",
        "image": "https://cdn.pgecom.com/giftcards/f23b1e3b-321d-4e9c-8afb-6bc475d82eb2.png",
        "provider": "pgecom",
        "isStandardDelivery": false,
        "id": "fd3bb9f8-4c9a-4a3d-8ac6-9588be63d371",
        "feePercentage": 8,
        "fixedFee": 1.5,
        "isUrgentDelivery": false,
        "instantDeliveryFee": 9,
        "standardDeliveryFee": 5,
        "isPriceFixed": true,
        "isRegularDelivery": false,
        "createdAt": "2024-05-09T01:26:51.476Z",
        "isExpressDelivery": false,
        "regularDeliveryFee": 7,
        "isInstantDelivery": true,
        "providerId": "1386",
        "platform": "pgrewards",
        "updatedAt": "2024-06-01T03:23:34.560Z",
        "urgentDeliveryFee": 12,
        "minimum": 5,
        "isActivated": true,
        "type": "ebay"
    },
    {
        "maximum": 1000,
        "defaultDelivery": "instant",
        "expressDeliveryFee": 5,
        "displayName": "Apple",
        "image": "https://cdn.pgecom.com/giftcards/08ed62a9-52d3-47d2-9ad8-ae27d0a3f3a2.png",
        "provider": "pgecom",
        "isStandardDelivery": false,
        "id": "3d40ea27-f038-4d78-9707-c9e268db6df5",
        "feePercentage": 5,
        "fixedFee": 1.5,
        "isUrgentDelivery": false,
        "instantDeliveryFee": 5,
        "standardDeliveryFee": 5,
        "isPriceFixed": false,
        "isRegularDelivery": false,
        "createdAt": "2024-05-09T01:05:00.998Z",
        "isExpressDelivery": false,
        "regularDeliveryFee": 5,
        "isInstantDelivery": true,
        "providerId": "21",
        "platform": "pgrewards",
        "updatedAt": "2024-06-01T15:03:44.714Z",
        "urgentDeliveryFee": 5,
        "minimum": 2,
        "isActivated": true,
        "type": "apple"
    },
    {
        "maximum": 30,
        "defaultDelivery": "instant",
        "expressDeliveryFee": 3,
        "displayName": "Free Fire",
        "image": "https://cdn.pgecom.com/giftcards/c722d3a0-3e51-421e-a30a-51680a40e6ae.jpg",
        "provider": "pgecom",
        "isStandardDelivery": false,
        "id": "d46a3b7b-e0d1-4c26-a472-f7d7b48ab8d2",
        "feePercentage": 3,
        "fixedFee": 0,
        "isUrgentDelivery": false,
        "instantDeliveryFee": 3,
        "standardDeliveryFee": 3,
        "isPriceFixed": true,
        "isRegularDelivery": false,
        "createdAt": "2024-05-09T01:28:33.130Z",
        "isExpressDelivery": false,
        "regularDeliveryFee": 3,
        "isInstantDelivery": true,
        "providerId": "14873",
        "platform": "pgrewards",
        "updatedAt": "2024-06-06T23:20:20.799Z",
        "urgentDeliveryFee": 3,
        "minimum": 1,
        "isActivated": true,
        "type": "freefire"
    },
    {
        "standardDeliveryFee": 9,
        "maximum": 1000,
        "isRegularDelivery": true,
        "createdAt": "2024-05-09T01:25:01.104Z",
        "defaultDelivery": "express",
        "isExpressDelivery": true,
        "regularDeliveryFee": 12,
        "expressDeliveryFee": 15,
        "displayName": "Binance International",
        "providerId": "pgrewards",
        "image": "https://cdn.pgecom.com/giftcards/e9333314-918b-4339-b495-854b7f714376.png",
        "platform": "pgrewards",
        "updatedAt": "2024-06-01T03:24:54.494Z",
        "urgentDeliveryFee": 17,
        "minimum": 5,
        "provider": "pgecom",
        "isActivated": true,
        "isStandardDelivery": true,
        "id": "ebb01556-9f6f-4e2c-a6ed-08c1f96ff83b",
        "feePercentage": 15,
        "fixedFee": 0,
        "isUrgentDelivery": true,
        "type": "binance"
    },
    {
        "instantDeliveryFee": 15,
        "standardDeliveryFee": 5,
        "maximum": 1000,
        "isRegularDelivery": true,
        "createdAt": "2024-05-09T19:35:22.125Z",
        "defaultDelivery": "express",
        "isExpressDelivery": true,
        "regularDeliveryFee": 7,
        "expressDeliveryFee": 9,
        "displayName": "MasterCard",
        "providerId": "18597",
        "image": "https://cdn.pgecom.com/giftcards/08ca41fe-e059-4dea-9dde-aff6ec231303.png",
        "platform": "pgrewards",
        "updatedAt": "2024-05-20T17:30:59.722Z",
        "urgentDeliveryFee": 12,
        "minimum": 5,
        "provider": "pgecom",
        "isActivated": false,
        "isStandardDelivery": true,
        "id": "dee2571a-b989-448e-8c93-f25ee984106f",
        "feePercentage": 8,
        "isUrgentDelivery": true,
        "type": "mastercard"
    }
]
```

{% endtab %}
{% endtabs %}


# Order a gift card

## Order a gift card

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

#### Request Body

| Name                                       | Type   | Description                                                                                                                                                                      |
| ------------------------------------------ | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| fullName<mark style="color:red;">\*</mark> | String | The full name of the recipient                                                                                                                                                   |
| email<mark style="color:red;">\*</mark>    | String | The recipient email. Please note that the gift card will be sent to this email. Make sure that it's correct                                                                      |
| id                                         | Number | The gift card id from the list of gift cards                                                                                                                                     |
| amount                                     | Number | The amount in usd that you'd like to send to the user                                                                                                                            |
| delivery                                   | String | How fast you want the gift cards. Most giftCards are instant but you can also choose how you want to send them (ex: standard, regular, express, urgent, or instant)              |
| phone                                      | String | The phone number of the recipient                                                                                                                                                |
| quantity                                   | String | The quantity of gift cards that you'd like to order                                                                                                                              |
| webhookUrl                                 | String | <p>This will receive post a request with the following values when the gift card is complete<br>- orderId<br>- status<br>- transactionId<br>- currency<br>- token</p><p><br></p> |
| metadata                                   | Object | An object of additional values that you'd like to retrieve on the order                                                                                                          |

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

```json
{
    "message": "Gift card purchased successfully"
}

```

{% endtab %}
{% endtabs %}


# Get giftcard

## Get a gift card

<mark style="color:green;">`POST`</mark> `https://sandbox.pgecom.com/api/v1/giftcard/{{id}}`

When you fetch for a gift card, always check if the isActivated is enabled.

If not, that means that this giftCard is currently disabled in our platform and won't be able to place order

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

```json
{
    "maximum": 30,
    "defaultDelivery": "instant",
    "expressDeliveryFee": 3,
    "displayName": "Free Fire",
    "image": "https://cdn.reloadly.com/giftcards/c722d3a0-3e51-421e-a30a-51680a40e6ae.jpg",
    "provider": "pgecom",
    "isStandardDelivery": false,
    "id": "d46a3b7b-e0d1-4c26-a472-f7d7b48ab8d2",
    "feePercentage": 3,
    "fixedFee": 0,
    "isUrgentDelivery": false,
    "instantDeliveryFee": 3,
    "standardDeliveryFee": 3,
    "isPriceFixed": true,
    "isRegularDelivery": false,
    "createdAt": "2024-05-09T01:28:33.130Z",
    "isExpressDelivery": false,
    "regularDeliveryFee": 3,
    "isInstantDelivery": true,
    "providerId": "14873",
    "platform": "pgrewards",
    "updatedAt": "2024-06-06T23:20:20.799Z",
    "urgentDeliveryFee": 3,
    "minimum": 1,
    "isActivated": true,
    "type": "freefire"
}
```

{% endtab %}
{% endtabs %}


# Rates

## Gift Card Rates

<mark style="color:green;">`POST`</mark> `https://sandbox.pgecom.com/api/v1/giftcard/rates`

You can use this endpoint to check gift card rates before placing the order

#### Request Body

| Name                                     | Type   | Description                                         |
| ---------------------------------------- | ------ | --------------------------------------------------- |
| id<mark style="color:red;">\*</mark>     | String | The id of the gift cards                            |
| amount<mark style="color:red;">\*</mark> | String | The amount that you want to end the receiver        |
| quantity                                 | Number | The quantity of gift cards that you'd like to order |
| delivery                                 | Number | The delivery method that you'd like to choose.      |

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

```json
{
    "id": "d46a3b7b-e0d1-4c26-a472-f7d7b48ab8d2",
    "amount": 5,
    "quantity": 1,
    "delivery": "standard",
    "fees": 0.15
}
```

{% endtab %}
{% endtabs %}


# Send rewards

Send rewards to peer to peer on PG Rewards

<details>

<summary>Card Response Example</summary>

```json
// Card Example
{
    "id": "ic_1LVrfdEDjZxHmkzHqsxUEuHe",
    "object": "issuing.card",
    "brand": "Visa",
    "cancellation_reason": null,
    "cardholder": {
        "id": "ich_1LVrf5EDjZxfmxzHaBKaw6v5",
        "object": "issuing.cardholder",
        "billing": {
            "address": {
                "city": "John Creeks",
                "country": "US",
                "line1": "Demo Street",
                "line2": null,
                "postal_code": "90098",
                "state": "GA"
            }
        },
        "company": null,
        "created": 1660286883,
        "email": "ukdgckvdxtqfmbrdea@bvhrs.com",
        "individual": null,
        "livemode": false,
        "metadata": {
            "email": "ukdgckvdxtqfmbrdea@bvhrs.com",
            "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd"
        },
        "name": "John Doe",
        "phone_number": null,
        "requirements": {
            "disabled_reason": null,
            "past_due": []
        },
        "spending_controls": {
            "allowed_categories": [],
            "blocked_categories": [],
            "spending_limits": [],
            "spending_limits_currency": null
        },
        "status": "active",
        "type": "individual"
    },
    "created": 1660286917,
    "currency": "usd",
    "exp_month": 7,
    "exp_year": 2025,
    "financial_account": null,
    "last4": "1714",
    "livemode": false,
    "metadata": {
        "email": "ukdgckvdxtqfmbrdea@bvhrs.com",
        "isPrepaid": "false",
        "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd"
    },
    "replaced_by": null,
    "replacement_for": null,
    "replacement_reason": null,
    "shipping": null,
    "spending_controls": {
        "allowed_categories": null,
        "blocked_categories": null,
        "spending_limits": [
            {
                "amount": 50000,
                "categories": [],
                "interval": "daily"
            }
        ],
        "spending_limits_currency": "usd"
    },
    "status": "active",
    "type": "virtual",
    "wallets": {
        "apple_pay": {
            "eligible": true,
            "ineligible_reason": null
        },
        "google_pay": {
            "eligible": true,
            "ineligible_reason": null
        },
        "primary_account_identifier": null
    },
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd"
}
```

</details>


# Rewards Schema     &#x20;

<table><thead><tr><th width="197">Property</th><th width="146">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>email</code></td><td>string</td><td>Recipient email</td></tr><tr><td><code>amount</code></td><td>string</td><td>Amount for the recipient</td></tr><tr><td><code>isPrepaid</code></td><td>string</td><td>User created via your platform, default <code>true</code></td></tr></tbody></table>


# Send rewards

## Send rewards or recharge a user's balance

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

#### Headers

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

#### Request Body

| Name                                     | Type   | Description                                                            |
| ---------------------------------------- | ------ | ---------------------------------------------------------------------- |
| email<mark style="color:red;">\*</mark>  | Number | Recipient's email                                                      |
| amount<mark style="color:red;">\*</mark> | String | Recipient's amount                                                     |
| isPrepaid                                | String | PG rewards user or your platform's user. Default to `true` (your user) |

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

```json
{
    "createdAt": "2022-05-09T09:48:51Z",
    "amount": 5806,
    "id": "7fe037b8-3d86-4bc3-9b47-839565kj1068",
    "userID": "7fe037b8-3d86-4bc3-9b47-839565kj1068",
    "updatedAt": "2022-06-29T10:30:23Z",
    "balance": 5806,
    "newBalance": 5811
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
You can use send rewards as a way to recharge a user's account. The funds will automatically be available on their virtual or physical card
{% endhint %}


# Withdraw

Send funds from your pgecom balance to&#x20;

* MonCash
* NatCash
* PayPal
* CashApp
* Zelle
* Wise
* Sogebank
* BNC
* BUH
* Unibank
* Payoneer
* PGecom
* etc

You can choose between different currency (**htg** or **usd**) to send the funds

<details>

<summary>Withdraw Response</summary>

```json
{
    "newBalance": 638.64,
    "sender": "info@pgecom.com",
    "receiver": "info@pgecom.com",
    "orderId": "a1d52cce-2f80-448f-bfe8-b9c95ed1f2db",
    "amount": 5,
    "gourdes": 660,
    "userFee": 0.15,
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "deliveryMethod": "standard",
    "transactionType": "moncash_withdraw",
    "currency": "usd",
    "status": "processing",
    "metadata": {
        "currency": "usd"
    },
    "id": "028ed5e0-30ae-43de-8e94-6254c55e8ccb",
    "platform": "pgrewards",
    "createdAt": "2024-06-03T22:47:35.538Z",
    "updatedAt": "2024-06-03T22:47:35.538Z",
    "delivery": "standard"
}
```

</details>


# Withdraw Schema

<table><thead><tr><th width="197">Property</th><th width="225">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>receiverEmail</code></td><td>string - required</td><td>Recipient's email address</td></tr><tr><td><code>amount</code></td><td>string - required</td><td>The amount to send to recipient. If you're sending <strong>htg</strong> as the currency, this is the amount of gourdes </td></tr><tr><td><code>type</code></td><td>string - default pgecom</td><td>Where you want to send the funds (PGecom, MonCash, NatCash, Sogebank, etc)</td></tr><tr><td><code>delivery</code></td><td>string - default instant</td><td>When do you want the funds to be available (standard, regular, express, urgent, instant)</td></tr><tr><td><code>currency</code></td><td>string - default usd</td><td>The currency that you'd like to send the funds to</td></tr><tr><td><code>message</code></td><td>string</td><td>A custom message for the recipient to receive </td></tr><tr><td><code>firstName</code></td><td>string</td><td>The first name of the recipient</td></tr><tr><td><code>lastName</code></td><td>string</td><td>The last name of the recipient</td></tr><tr><td><code>accountNumber</code></td><td>string</td><td>The bank account number</td></tr><tr><td><code>accountName</code></td><td>string</td><td>The account name</td></tr><tr><td><code>routingNumber</code></td><td>string</td><td>The routing account if any</td></tr><tr><td><code>accountType</code></td><td>string</td><td>The bank account type if any</td></tr><tr><td><code>address</code></td><td>string</td><td>The recipient address if any</td></tr><tr><td><code>webhookUrl</code></td><td>string</td><td>The url that you'd like to receive a withdraw is successful</td></tr><tr><td><code>metadata</code></td><td>object</td><td>You can pass additional values if you need to receive it once the order is complete</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

<table><thead><tr><th>Types</th><th>Value</th><th data-hidden></th></tr></thead><tbody><tr><td>PGecom</td><td>pgecom - (automatic)</td><td></td></tr><tr><td>MonCash</td><td>moncash - (automatic)</td><td></td></tr><tr><td>NatCash</td><td>natcash</td><td></td></tr><tr><td>Wise</td><td>wise</td><td></td></tr><tr><td>Sogebank</td><td>sogebank</td><td></td></tr><tr><td>PayPal</td><td>paypal</td><td></td></tr><tr><td>Zelle</td><td>Zelle</td><td></td></tr><tr><td>CashApp</td><td>cashapp</td><td></td></tr><tr><td>Unitransfer</td><td>unitransfer</td><td></td></tr><tr><td>BUH</td><td>buh</td><td></td></tr><tr><td>BNC</td><td>bnc</td><td></td></tr><tr><td>Unibank</td><td>unibank</td><td></td></tr></tbody></table>

| Delivery | Value    | Processing Time |
| -------- | -------- | --------------- |
| Standard | standard | 2 business days |
| Regular  | regular  | 1 business day  |
| Express  | express  | 2 hours         |
| Urgent   | urgent   | 30 minutes      |
| Instant  | instant  | 2 minutes       |
|          |          |                 |


# Process Withdraw

## Withdrawal Endpoint

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

#### Headers

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

#### Request Body

<table><thead><tr><th width="197">Property</th><th width="225">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>receiverEmail</code></td><td>string - required</td><td>Recipient's email address</td></tr><tr><td><code>amount</code></td><td>string - required</td><td>The amount to send to recipient. If you're sending <strong>htg</strong> as the currency, this is the amount of gourdes </td></tr><tr><td><code>type</code></td><td>string - default pgecom</td><td>Where you want to send the funds (PGecom, MonCash, NatCash, Sogebank, etc)</td></tr><tr><td><code>delivery</code></td><td>string - default instant</td><td>When do you want the funds to be available (standard, regular, express, urgent, instant)</td></tr><tr><td><code>currency</code></td><td>string - default usd</td><td>The currency that you'd like to send the funds to</td></tr><tr><td><code>message</code></td><td>string</td><td>A custom message for the recipient to receive </td></tr><tr><td><code>firstName</code></td><td>string</td><td>The first name of the recipient</td></tr><tr><td><code>lastName</code></td><td>string</td><td>The last name of the recipient</td></tr><tr><td><code>accountNumber</code></td><td>string</td><td>The bank account number</td></tr><tr><td><code>accountName</code></td><td>string</td><td>The account name</td></tr><tr><td><code>routingNumber</code></td><td>string</td><td>The routing account if any</td></tr><tr><td><code>accountType</code></td><td>string</td><td>The bank account type if any</td></tr><tr><td><code>address</code></td><td>string</td><td>The recipient address if any</td></tr><tr><td><code>webhookUrl</code></td><td>string</td><td>The url that you'd like to receive a withdraw is successful</td></tr><tr><td><code>metadata</code></td><td>object</td><td>You can pass additional values if you need to receive it once the order is complete</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

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

```json
{
    "newBalance": 638.64,
    "sender": "info@pgecom.com",
    "receiver": "info@pgecom.com",
    "orderId": "a1d52cce-2f80-448f-bfe8-b9c95ed1f2db",
    "amount": 5,
    "gourdes": 660,
    "userFee": 0.15,
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "deliveryMethod": "standard",
    "transactionType": "moncash_withdraw",
    "currency": "usd",
    "status": "processing",
    "metadata": {
        "currency": "usd"
    },
    "id": "028ed5e0-30ae-43de-8e94-6254c55e8ccb",
    "platform": "pgrewards",
    "createdAt": "2024-06-03T22:47:35.538Z",
    "updatedAt": "2024-06-03T22:47:35.538Z",
    "delivery": "standard"
}
```

{% endtab %}
{% endtabs %}


# Rates

## Estimation endpoint

<mark style="color:green;">`POST`</mark> `https://sandbox.pgecom.com/api/v1/withdraw/rates`

#### Headers

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

#### Request Body

<table><thead><tr><th width="197">Property</th><th width="225">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>receiverEmail</code></td><td>string - required</td><td>Recipient's email address</td></tr><tr><td><code>amount</code></td><td>string - required</td><td>The amount to send to recipient. If you're sending <strong>htg</strong> as the currency, this is the amount of gourdes </td></tr><tr><td><code>type</code></td><td>string - default pgecom</td><td>Where you want to send the funds (PGecom, MonCash, NatCash, Sogebank, etc)</td></tr><tr><td><code>delivery</code></td><td>string - default instant</td><td>When do you want the funds to be available (standard, regular, express, urgent, instant)</td></tr><tr><td><code>currency</code></td><td>string - default usd</td><td>The currency that you'd like to send the funds to</td></tr><tr><td><code>message</code></td><td>string</td><td>A custom message for the recipient to receive </td></tr><tr><td><code>firstName</code></td><td>string</td><td>The first name of the recipient</td></tr><tr><td><code>lastName</code></td><td>string</td><td>The last name of the recipient</td></tr><tr><td><code>accountNumber</code></td><td>string</td><td>The bank account number</td></tr><tr><td><code>accountName</code></td><td>string</td><td>The account name</td></tr><tr><td><code>routingNumber</code></td><td>string</td><td>The routing account if any</td></tr><tr><td><code>accountType</code></td><td>string</td><td>The bank account type if any</td></tr><tr><td><code>address</code></td><td>string</td><td>The recipient address if any</td></tr><tr><td><code>metadata</code></td><td>object</td><td>You can pass additional values if you need to receive it once the order is complete</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

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

```json

{
    "amount": 1,
    "gourdes": 132,
    "fees": 0.03,
    "delivery": "standard"
}
```

{% endtab %}
{% endtabs %}


# Radar

You can use the Radar endpoint to check for fraudster reported through our network of partners that we work with

<details>

<summary>Radar Response</summary>

```json
{
    "status": "not_flagged",
    "severity": "low",
    "notes": "No fraud detected"
}
```

</details>


# Radar Schema

<table><thead><tr><th width="197">Property</th><th width="225">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>query</code></td><td>string - required</td><td>You can pass email, phone number, name as a query</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>


# Check for Fraudster

## Radar Endpoint

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

#### Headers

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

#### Request Body

<table><thead><tr><th width="197">Property</th><th width="225">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>query</code></td><td>string - required</td><td>You can pass email, phone number, name as a query</td></tr></tbody></table>

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

```json
{
    "status": "not_flagged",
    "severity": "low",
    "notes": "No fraud detected"
}
```

{% endtab %}
{% endtabs %}


# Top Up

Send prepaid minutes to any phone in more than 120 countries

<details>

<summary>Estimate Response</summary>

```
[
    {
        "price": {
            "customerFee": 0,
            "distributorFee": 0,
            "receiveValue": 603.1,
            "receiveCurrencyIso": "HTG",
            "receiveValueExcludingTax": 603.1,
            "taxRate": 0,
            "sendValue": 5,
            "sendCurrencyIso": "USD"
        },
        "skuCode": "HT_DC_TopUp",
        "batchItemRef": "HT_DC_TopUp",
        "resultCode": 1,
        "rrrorCodes": []
    }
]
```

</details>

<details>

<summary>Transfer Response</summary>

```json
{
    "transferId": {
        "transferRef": "0",
        "distributorRef": "5f56dfa3-a415-4818-8275-44fc63ece3fd"
    },
    "skuCode": "HT_DC_TopUp",
    "price": {
        "customerFee": 0,
        "distributorFee": 0,
        "receiveValue": 603.1,
        "receiveCurrencyIso": "HTG",
        "receiveValueExcludingTax": 603.1,
        "taxRate": 0,
        "sendValue": 5,
        "sendCurrencyIso": "USD"
    },
    "processingState": "Complete",
    "accountNumber": "50938737629",
    "resultCode": 1,
    "errorCodes": []
}
```

</details>


# Topup Schema

<table><thead><tr><th width="197">Property</th><th width="146">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>phone</code></td><td>string</td><td>Recipient phone ex: +50938737829</td></tr><tr><td><code>amount</code></td><td>string</td><td>Amount for the recipient in USD</td></tr><tr><td><code>skuCode</code></td><td>string</td><td>mobile operator code ex: HT_DC_TopUp</td></tr></tbody></table>


# Estimate

## Send top up to more than 120 countries

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

#### Headers

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

#### Request Body

| Name                                     | Type   | Description                       |
| ---------------------------------------- | ------ | --------------------------------- |
| phone<mark style="color:red;">\*</mark>  | Number | Receiver's phone ex: +50938737829 |
| amount<mark style="color:red;">\*</mark> | String | Receiver's amount in USD          |

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

```json
[
    {
        "price": {
            "customerFee": 0,
            "distributorFee": 0,
            "receiveValue": 603.1,
            "receiveCurrencyIso": "HTG",
            "receiveValueExcludingTax": 603.1,
            "taxRate": 0,
            "sendValue": 5,
            "sendCurrencyIso": "USD"
        },
        "skuCode": "HT_DC_TopUp",
        "batchItemRef": "HT_DC_TopUp",
        "resultCode": 1,
        "rrrorCodes": []
    }
]
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Make sure that you save the skuCode. You'll need it to complete the transaction.&#x20;
{% endhint %}


# Send

## Send top up to more than 120 countries

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

#### Headers

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

#### Request Body

| Name                                      | Type   | Description                        |
| ----------------------------------------- | ------ | ---------------------------------- |
| phone<mark style="color:red;">\*</mark>   | Number | Receiver's phone ex: +50938737829  |
| amount<mark style="color:red;">\*</mark>  | String | Receiver's amount in USD           |
| skuCode<mark style="color:red;">\*</mark> | String | skuCode from the estimate endpoint |

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

```json
{
    "transferId": {
        "transferRef": "0",
        "distributorRef": "5f56dfa3-a415-4818-8275-44fc63ece3fd"
    },
    "skuCode": "HT_DC_TopUp",
    "price": {
        "customerFee": 0,
        "distributorFee": 0,
        "receiveValue": 603.1,
        "receiveCurrencyIso": "HTG",
        "receiveValueExcludingTax": 603.1,
        "taxRate": 0,
        "sendValue": 5,
        "sendCurrencyIso": "USD"
    },
    "processingState": "Complete",
    "accountNumber": "50938737629",
    "resultCode": 1,
    "errorCodes": []
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
You'll get the skuCode from the estimate endpoint
{% endhint %}


# Payment


# Mon Cash

Accept Mon Cash Payment your customers and receive funds to your PG Rewards account

<details>

<summary>Card Response Example</summary>

```json
{
    "redirectUrl": "http://moncashbutton.digicelgroup.com/Moncash-middleware/Payment/Redirect?token=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjIyOTY5Njg2IiwicmVmIjoiNThiNDc5YzYtNmU5Ni00OTgwLThjMjctNGI4NjhiMzlhNWVlIiwiY3J0IjoxNjYzNjM2OTExMjkzLCJleHQiOjE2NjM2Mzc1MTEyOTMsImFwaSI6dHJ1ZX0.UhitaXt-2ZLxMHFc0zz5xU3lTXMXBYjR2-b7XUspyc_8-WBY8JXbesKRAt348K1hrDxZVYM69bH8tTr9cN8-p4vB0wMGJydYKZKkvTAQ9PLbg5GdvLNQew-Uo2J87WllTuMrneu4-MeioGb7UGmEVlaQIz6LEYSZLknsymYS_n-k6lRuU6AfLJ0SsuAonGwbUTBY-o7wIdV14CW-T6xpkknEO80xazrUSjhPNu1vGZ6mJkzLafuNyQxiWd5MMyLJ9V1hI4pfBBZcB6Lk90yrMA1i09aJpaIJVEGbPkTRzhZXMrKaelfeU2xl7uJefTyZBM65jgsHPxh-7ARTS2HVVA",
    "orderId": "58b479c6-6e96-4980-8c27-4b868b39a5ee",
    "payment": {
        "mode": "live",
        "path": "/Api/v1/CreatePayment",
        "payment_token": {
            "expired": "2022-09-19 09:31:51:293",
            "created": "2022-09-19 09:21:51:293",
            "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjIyOTY5Njg2IiwicmVmIjoiNThiNDc5YzYtNmU5Ni00OTgwLThjMjctNGI4NjhiMzlhNWVlIiwiY3J0IjoxNjYzNjM2OTExMjkzLCJleHQiOjE2NjM2Mzc1MTEyOTMsImFwaSI6dHJ1ZX0.UhitaXt-2ZLxMHFc0zz5xU3lTXMXBYjR2-b7XUspyc_8-WBY8JXbesKRAt348K1hrDxZVYM69bH8tTr9cN8-p4vB0wMGJydYKZKkvTAQ9PLbg5GdvLNQew-Uo2J87WllTuMrneu4-MeioGb7UGmEVlaQIz6LEYSZLknsymYS_n-k6lRuU6AfLJ0SsuAonGwbUTBY-o7wIdV14CW-T6xpkknEO80xazrUSjhPNu1vGZ6mJkzLafuNyQxiWd5MMyLJ9V1hI4pfBBZcB6Lk90yrMA1i09aJpaIJVEGbPkTRzhZXMrKaelfeU2xl7uJefTyZBM65jgsHPxh-7ARTS2HVVA"
        },
        "timestamp": 1663636911300,
        "status": 202,
        "httpStatusCode": 202
    }
}
```

</details>


# CreateMonCashPayment

## Create mon cash payment

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

#### Request Body

| Name                                     | Type   | Description                                                                                                                                                                                          |
| ---------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| gdes<mark style="color:red;">\*</mark>   | Number | Amount in gdes that convert in USD to your account                                                                                                                                                   |
| userID<mark style="color:red;">\*</mark> | String | Your userID on PG Rewards so you can receive the funds                                                                                                                                               |
| referenceId                              | String | Your internal reference ID for your own tracking                                                                                                                                                     |
| successUrl                               | String | Where you want us to redirect the user once we have completed the transaction                                                                                                                        |
| errorUrl                                 | String | Where you want us to redirect the user once in case any error happens                                                                                                                                |
| metadata                                 | String | Pass additional data you need to be retrieve when fetching order                                                                                                                                     |
| customerFirstName                        | String | Customer first name                                                                                                                                                                                  |
| customerLastName                         | String | Customer last name                                                                                                                                                                                   |
| customerEmail                            | String | Customer email                                                                                                                                                                                       |
| phone                                    | String | MonCash phone number                                                                                                                                                                                 |
| currency                                 | String | Currency that you want to receive the funds to your account - default usd                                                                                                                            |
| webhookUrl                               | String | <p>We send a post a request with the following data to this endpoint once the deposit has finalized</p><ul><li>orderId</li><li>status</li><li>transactionId</li><li>currency</li><li>token</li></ul> |
|                                          |        |                                                                                                                                                                                                      |

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

```json
{
    "sender": "info@pgecom.com",
    "id": "7a8d8d40-3c38-4de8-a0a0-a7df1617cf12",
    "orderId": "7a8d8d40-3c38-4de8-a0a0-a7df1617cf12",
    "gourdes": 500.886767,
    "amount": 3.37,
    "platform": "pgrewards",
    "successUrl": "http://google.com",
    "receiver": "info@pgecom.com",
    "errorUrl": "",
    "metadata": {},
    "operatorId": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "customerId": "87ee04dd-41e8-42e8-b5b9-16c0e4a04c17",
    "currency": "usd",
    "status": "pending",
    "transactionType": "moncash_deposit",
    "redirectUrl": "http://sandbox.moncashbutton.digicelgroup.com/Moncash-middleware/Payment/Redirect?token=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjExMDgyNSIsInJlZiI6IjdhOGQ4ZDQwLTNjMzgtNGRlOC1hMGEwLWE3ZGYxNjE3Y2YxMiIsImNydCI6MTcwNDE1MDU0MTQ4MiwiZXh0IjoxNzA0MTUxMTQxNDgyLCJhcGkiOnRydWV9.Yuj9msvDcrlElKzd8yWFw0k28rt8AUNoCMlfKEtFASYqf0haLCspJRQNz7lm6UEy67VXmtgTJFN7PW6jYoOm2BQpT95Ezdn7QIzyNPAFOOt9Zd8Dk2sGJ74HwuOfsTLIYkTvBGaBCH2pMaqL1ZJ2GY-U-SwrzCpiokGbXaoIYIzpH9QAvkYg_XWTh6RIHjN3sPdKBfAYAT6ziFBbt5ivzSnkTbYaf0VjpWU_LDNwxsh7jOsE71zQqcmhheFpbTLydk3Thy_96Cqa4Yx2O55Qhi9rdm7TriIEoby0B0bKC3VsOT4r6vQsNvLJfXjEd8KTs7QADVi3f7fmHFNKpflTmg",
    "payment": {
        "mode": "sandbox",
        "path": "/Api/v1/CreatePayment",
        "payment_token": {
            "expired": "2024-01-01 06:19:01:482",
            "created": "2024-01-01 06:09:01:482",
            "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjExMDgyNSIsInJlZiI6IjdhOGQ4ZDQwLTNjMzgtNGRlOC1hMGEwLWE3ZGYxNjE3Y2YxMiIsImNydCI6MTcwNDE1MDU0MTQ4MiwiZXh0IjoxNzA0MTUxMTQxNDgyLCJhcGkiOnRydWV9.Yuj9msvDcrlElKzd8yWFw0k28rt8AUNoCMlfKEtFASYqf0haLCspJRQNz7lm6UEy67VXmtgTJFN7PW6jYoOm2BQpT95Ezdn7QIzyNPAFOOt9Zd8Dk2sGJ74HwuOfsTLIYkTvBGaBCH2pMaqL1ZJ2GY-U-SwrzCpiokGbXaoIYIzpH9QAvkYg_XWTh6RIHjN3sPdKBfAYAT6ziFBbt5ivzSnkTbYaf0VjpWU_LDNwxsh7jOsE71zQqcmhheFpbTLydk3Thy_96Cqa4Yx2O55Qhi9rdm7TriIEoby0B0bKC3VsOT4r6vQsNvLJfXjEd8KTs7QADVi3f7fmHFNKpflTmg"
        },
        "timestamp": 1704150541499,
        "status": 202,
        "httpStatusCode": 202
    },
    "referenceId": ""
}
```

{% endtab %}

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

```json
{
    "message": "Amount should be less than 75000 gdes",
    "status": 400
}
```

{% endtab %}
{% endtabs %}

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

```javascript
const axios = require('axios');
let data = {
    "gdes": 500.88,
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "successUrl": "http://google.com",
    "description": "",
    "referenceId": "",
    "errorUrl": "",
    "customerFirstName": "",
    "customerLastName": "",
    "customerEmail": "",
    "metadata": {}
}
let config = {
  method: 'post',
  url: 'https://sandbox.pgecom.com/api/v1/moncash/token',
  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/v1/moncash/token"

payload = {
    "gdes": 500.88,
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "successUrl": "http://google.com",
    "description": "",
    "referenceId": "",
    "errorUrl": "",
    "customerFirstName": "",
    "customerLastName": "",
    "customerEmail": "",
    "metadata": {}
}
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/v1/moncash/token")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request.body = {
    "gdes": 500.88,
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "successUrl": "http://google.com",
    "description": "",
    "referenceId": "",
    "errorUrl": "",
    "customerFirstName": "",
    "customerLastName": "",
    "customerEmail": "",
    "metadata": {}
}
response = http.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/v1/moncash/token');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setBody({
    "gdes": 500.88,
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "successUrl": "http://google.com",
    "description": "",
    "referenceId": "",
    "errorUrl": "",
    "customerFirstName": "",
    "customerLastName": "",
    "customerEmail": "",
    "metadata": {}
})
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/v1/moncash/token' \
--data '{
    "gdes": 500.886767,
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "successUrl": "http://google.com",
    "description": "",
    "referenceId": "",
    "errorUrl": "",
    "customerFirstName": "",
    "customerLastName": "",
    "customerEmail": "",
    "metadata": {}
}'
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
If transaction successful or failed, we'll include the following to the errorUrl or `successUrl:`

* `${successUrl}?transactionId=${order.id}`
* ${errorUrl}?transactionId=${order.id}\&errorMessage=${errorMessage}
  {% endhint %}


# VerifyMonCashPayment

## Retrieve a order by orderId

<mark style="color:blue;">`GET`</mark> `https://sandbox.pgecom.com/api/order/{orderId}`

#### Headers

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

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

```json
{
    "quantity": 1,
    "receiver": "info@pgecom.com",
    "metadata": {
        "isChatEnabled": true,
        "pgPayMerchantName": "PGecom",
        "isProd": false,
        "customerEmail": "info@pgecom.com",
        "customerFirstName": "Esterling",
        "customerLastName": "Accime",
        "returnUrl": "https://sandbox.pgecom.com/payment/pgpay/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJvcmRlcklkIjoiYjU5YTA5MzktYzgyNC00NzMyLThiMmYtMzZmNDE3NDM3ZTJhIiwiaWF0IjoxNzA0MTQyNDE3LCJleHAiOjE3MDQxNDYwMTd9.JB3oVi3nH0Yw_Q9F1x-1N8bBTkJkRAjoKYq_xIfH7x0?merchantName=PGecom&amount=25"
    },
    "orderId": "b59a0939-c824-4732-8b2f-36f417437e2a",
    "successUrl": "https://sandbox.pgecom.com/payment-success",
    "status": "pending",
    "createdAt": "2024-01-01T20:53:37.155Z",
    "transactionType": "pgpay",
    "sender": "info@pgecom.com",
    "errorUrl": "https://sandbox.pgecom.com/payment-error",
    "paymentStatus": "pending",
    "updatedAt": "2024-01-01T20:53:37.155Z",
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "amount": 25,
    "paymentMethod": "pgpay",
    "id": "b59a0939-c824-4732-8b2f-36f417437e2a",
    "deliveryMethod": "instant",
    "customerId": "87ee04dd-41e8-42e8-b5b9-16c0e4a04c17",
    "customer": {
        "lastName": "Accime",
        "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
        "updatedAt": "2023-09-29T07:01:11Z",
        "createdAt": "2023-09-29T07:01:11Z",
        "id": "87ee04dd-41e8-42e8-b5b9-16c0e4a04c17",
        "email": "info@pgecom.com",
        "phone": "+1 404 825 3444",
        "firstName": "Esterling"
    },
    "shop": {},
    "invoice": {},
    "products": []
}
```

{% endtab %}

{% tab title="401: Unauthorized Unauthorized" %}

```javascript
{
    "message": "jwt malformed - session expired",
    "status": 401
}
```

{% endtab %}

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

```javascript
{
    "message": "Order with id 1ddbb939-a8e9-4c31-85d-1cc5477574a9 not found",
    "status": 400
}
```

{% endtab %}
{% endtabs %}

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

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

let config = {
  method: 'get',
  url: 'https://sandbox.pgecom.com/api/order/b59a0939-c824-4732-8b2f-36f417437e2a',
  headers: { }
};

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

```

{% endtab %}

{% tab title="Python" %}

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

url = URI("https://sandbox.pgecom.com/api/order/b59a0939-c824-4732-8b2f-36f417437e2a")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body

```

{% endtab %}

{% tab title="Ruby" %}

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

url = URI("https://sandbox.pgecom.com/api/order/b59a0939-c824-4732-8b2f-36f417437e2a")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)

response = http.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/order/b59a0939-c824-4732-8b2f-36f417437e2a');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
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/order/b59a0939-c824-4732-8b2f-36f417437e2a'
```

{% endtab %}
{% endtabs %}


# WithdrawToMonCashEstimate

Check MonCash estimate before sending the funds

You can use this endpoint to check for monCash rates before sending the monCash

**amount: number**\
The amount of funds that you'd like to send. It depends on the balance type. If the balance type is "balance", then the amount should be in USD

**delivery: string -** default standard\
The delivery depends on how fast you want it. Here is a list of delivery type

* standard - 2 days - free
* regular - 24-hour - ***fees applied***
* instant - instantly (3 seconds - 2 minutes) - **fees applied**

## Withdraw mon cash payment

<mark style="color:green;">`POST`</mark> `https://sandbox.pgecom.com/api/user/withdraw/rates`

This endpoint is just for getting an estimate on how much the user will receive

#### Request Body

| Name                                     | Type   | Description                                           |
| ---------------------------------------- | ------ | ----------------------------------------------------- |
| amount<mark style="color:red;">\*</mark> | Number | Amount  in USD that you'd like to send                |
| delivery                                 | String | Delivery method - standard, regular, express, instant |

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

```json
{
    "amount": 20,
    "delivery": "standard",
    "gourdes": 2640,
    "feesInUSD": 0,
    "feesInHTG": 0,
    "exchangeAmount": 132,
    "amountAfterFees": 20
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Always verify the phone number or we'll issue the funds back to your account
{% endhint %}


# WithdrawFundsToMonCash

Send funds to MonCash automatically from your PGecom account

You can use this endpoint to send funds to MonCash directly

**amount: number**\
The amount of funds that you'd like to send. It depends on the balance type. If the balance type is "balance", then the amount should be in USD

**phone: string**\
The monCash phone of the user that you want to send the funds to. The phone number should be without the 509.\
ex: 34999435

**delivery: string -** default standard\
The delivery depends on how fast you want it. Here is a list of delivery type

* standard - 2 days - **free**
* regular - 24-hour - **fees**
* instant - instantly (5 seconds - 10 minutes) - **fees applied**

{% hint style="info" %}
Don't forget to check the [withdraw estimates](/api-endpoint/top-up/estimate) to check the rates before sending the funds to MonCash
{% endhint %}

## Withdraw mon cash payment

<mark style="color:green;">`POST`</mark> `https://sandbox.pgecom.com/api/user/withdraw/moncashwithdraw`

#### Request Body

| Name                                     | Type   | Description                                  |
| ---------------------------------------- | ------ | -------------------------------------------- |
| amount<mark style="color:red;">\*</mark> | Number | Amount  in USD that you'd like to send       |
| phone<mark style="color:red;">\*</mark>  | String | Mon Cash phone number without 509            |
| delivery                                 | String | Delivery method - standard, regular, instant |
| firstName                                | String | First name of the monCash recipient          |
| lastName                                 | String | Last name of the monCash recipient           |

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

```json

{
    "orderId": "a57148cd-76ab-4b48-ba44-31cd78b7a1dc",
    "status": "completed",
    "amount": 1,
    "phone": "+50934999435",
    "gourdes": 123,
    "delivery": "instant"
}
```

{% endtab %}
{% endtabs %}


# PG Pay

You can now accept Payment on your website with PG Pay which allows buyer to purchase your product with their PGecom balance

{% embed url="<https://youtu.be/hF3emAEIB0o?si=iVs8-THCSBvDP8Mb>" %}
PGPay Integration
{% endembed %}

Once you create your PGPay Payment request, you'll receive a redirect URL in the response

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FMo1q99DmM3i2Z1LXTgTu%2FScreenshot%202024-01-01%20at%2011.43.43%E2%80%AFAM.png?alt=media&amp;token=c0c52d08-f076-4244-8873-78f217b1625c" alt=""><figcaption><p>redirect url</p></figcaption></figure>

Once you redirect the user, they'll view something like this to complete their purchase

If you include a phone in the payload, it will automatically fill in the input form

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FpXOrqPwqDvK4HIzmHXuN%2Fpg_pay_step_one.png?alt=media&amp;token=dda476f1-9c0b-44f0-9571-3384604b61da" alt=""><figcaption><p>PG Pay Checkout Flow - User not logged in</p></figcaption></figure>

The pg pay integration will automatically detect if the user is already logged in and make the checkout process even easier to complete the purchase

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FOTDYflbXIwzMzN2aLXp5%2FScreenshot%202024-01-01%20at%2012.50.22%E2%80%AFPM.png?alt=media&amp;token=a9355774-f25f-4cbf-96fd-b7175ed6d8b0" alt=""><figcaption><p>PG Pay Checkout Flow - User already logged in</p></figcaption></figure>

The moment you create a checkout session for a customer

PGPay will start tracking that transaction until its completion

It will also register the customer information for future targeting

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FD3dNeZOB7oSEsjLgJXPa%2Fpg_pay_pending_transaction.png?alt=media&amp;token=e0d4f2e9-a400-4cc9-9f63-9e8ed877334c" alt=""><figcaption><p>PG Pay Pending and Complete transaction</p></figcaption></figure>

I hope you enjoy the PG Pay integration as much as we enjoy building it 🎉


# ConfigurePGPay

This guide will walk you through how to set up PG Pay as a merchant

You'll need to navigate to your PGecom account and click on **Settings > Developer**

<figure><img src="https://2078312875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FYwan9lhHakUSjsMZ27Is%2Fpgpay_developer.png?alt=media&amp;token=e1762221-910f-4275-9fd3-6450a6bcf3ef" alt=""><figcaption><p>PG Pay Merchant Set Up</p></figcaption></figure>

Then make sure that you fill out all the information

* Success Url
* Error Url
* Merchant Name

Please keep in mind once you've set the merchant name, you can **NOT** change it

The Success URL is very important so we can redirect the customer back to your platform

Expect the following params from the success or error URL

* **status**=completed&
* **orderId**=7f4f7086-74d6-4cd4-bdfa-5e10f761d562

At the your success or error URL will look like this

```
// Succcess URL - Success

https://sandbox.pgecom.com/payment-success?status=completed&orderId=7f4f7086-74d6-4cd4-bdfa-5e10f761d562

// Error URL - Error
https://sandbo.pgecom.com/payment-error?status=declined
```

Hope you enjoy PG Pay as much as we enjoy building it 🎉


# CreatePGPayPayment

Create a pg pay a checkout session

## Create a pg pay payment request

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

#### Request Body

| Name                                     | Type           | Description                                                                                                                                                                                                                                                                                  |
| ---------------------------------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| userID<mark style="color:red;">\*</mark> | String         | The receiver that's going to receive the funds                                                                                                                                                                                                                                               |
| amount<mark style="color:red;">\*</mark> | Number         | Amount to charge the customer. Learn more about our fees via this [link](https://help.pgecom.com/ht/article/fees-1irhphn/)                                                                                                                                                                   |
| currency                                 | String         | We currently only accept **htg** or **usd** as currency                                                                                                                                                                                                                                      |
| orderId                                  | String         | Your orderId for internal reference, if not provided, one is creating for you                                                                                                                                                                                                                |
| phone                                    | String         | Customer's phone number to autocomplete in the form                                                                                                                                                                                                                                          |
| description                              | String         | Description of the transaction                                                                                                                                                                                                                                                               |
| successUrl                               | String         | Success url to redirect to when payment is complete                                                                                                                                                                                                                                          |
| errorUrl                                 | String         | Error url to redirect to if payment fails                                                                                                                                                                                                                                                    |
| customerEmail                            | String         | Customer email                                                                                                                                                                                                                                                                               |
| customerFirstName                        | String         | Customer first name                                                                                                                                                                                                                                                                          |
| customerLastName                         | String         | Customer last name                                                                                                                                                                                                                                                                           |
| metadata                                 | Object         | Additional data to retrieve when fetching order                                                                                                                                                                                                                                              |
| isChatEnabled                            | Boolean        | Will disable the pgecom live chat support on the pgpay checkout flow                                                                                                                                                                                                                         |
| paymentMethods                           | Array\[String] | You can pass a list of payment methods that you want to enable (ex. pgpay, moncash, crypto)                                                                                                                                                                                                  |
| webhookUrl                               | string         | <p>This can be sent inside the metadata data as <code>metadata.webhookUrl</code> or directly in the payload. This will receive post a request with the following values when the transaction is complete<br>- orderId<br>- status<br>- transactionId<br>- currency<br>- token</p><p><br></p> |
|                                          |                |                                                                                                                                                                                                                                                                                              |

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

```json
{
    "amount": 0.91,
    "userID": "f725076f-ade0-4912-bc86-db1681700d91",
    "id": "41412be3-01fd-488a-a279-cadbe171b5e5",
    "orderId": "41412be3-01fd-488a-a279-cadbe171b5e5",
    "paymentMethod": "pgpay",
    "paymentStatus": "pending",
    "status": "pending",
    "deliveryMethod": "instant",
    "transactionType": "pgpay_deposit",
    "quantity": 1,
    "phone": "+50934748112",
    "gourdes": 55,
    "customerId": "e66d2dac-e514-42b7-8490-de3972709d7e",
    "successUrl": "https://pgecom.com",
    "currency": "htg",
    "sender": "info@pgecom.com",
    "metadata": {
        "is_matched": false,
        "gender": "female",
        "app_name": "Match.com",
        "webhookUrl": "https://webhook.site/40adf10b-9352-4d20-b23a-17d4f1a32a9f",
        "customerEmail": "info@pgecom.com",
        "isProd": false,
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJvcmRlcklkIjoiNDE0MTJiZTMtMDFmZC00ODhhLWEyNzktY2FkYmUxNzFiNWU1IiwiaWF0IjoxNzEzNDU5MjE2LCJleHAiOjE3MTM0NjI4MTZ9.-LqeTBDi1vOT1giyOLfnQ5hrpmrtrKbWxB_SqvZD5mU",
        "paymentMethods": [
            "moncash",
            "pgpay"
        ],
        "isChatEnabled": false,
        "pgPayMerchantName": "PGecom",
        "customerFirstName": "",
        "customerLastName": "",
        "returnUrl": "https://sandbox.pgecom.com/payment/pgpay/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJvcmRlcklkIjoiNDE0MTJiZTMtMDFmZC00ODhhLWEyNzktY2FkYmUxNzFiNWU1IiwiaWF0IjoxNzEzNDU5MjE2LCJleHAiOjE3MTM0NjI4MTZ9.-LqeTBDi1vOT1giyOLfnQ5hrpmrtrKbWxB_SqvZD5mU?merchantName=PGecom&amount=55"
    },
    "platform": "pgrewards",
    "redirectUrl": "http://localhost:3002/payment/pgpay/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJvcmRlcklkIjoiNDE0MTJiZTMtMDFmZC00ODhhLWEyNzktY2FkYmUxNzFiNWU1IiwiaWF0IjoxNzEzNDU5MjE2LCJleHAiOjE3MTM0NjI4MTZ9.-LqeTBDi1vOT1giyOLfnQ5hrpmrtrKbWxB_SqvZD5mU?merchantName=PGecom&amount=55",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJvcmRlcklkIjoiNDE0MTJiZTMtMDFmZC00ODhhLWEyNzktY2FkYmUxNzFiNWU1IiwiaWF0IjoxNzEzNDU5MjE2LCJleHAiOjE3MTM0NjI4MTZ9.-LqeTBDi1vOT1giyOLfnQ5hrpmrtrKbWxB_SqvZD5mU"
}
```

{% 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 = {
    "amount": 25,
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "customerEmail": "info@pgecom.com",
    "customerFirstName": "Esterling",
    "customerLastName": "Accime",
    "successUrl": "/success",
    "errorUrl": "/error"
}

let config = {
  method: 'post',
  url: 'https://sandbox.pgecom.com/api/pgpay/token',
  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/token"

payload = {
    "amount": 25,
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "customerEmail": "info@pgecom.com",
    "customerFirstName": "Esterling",
    "customerLastName": "Accime",
    "successUrl": "/success",
    "errorUrl": "/error"
}
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/token")

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

request = Net::HTTP::Post.new(url)
request.body = {
    "amount": 25,
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "customerEmail": "info@pgecom.com",
    "customerFirstName": "Esterling",
    "customerLastName": "Accime",
    "successUrl": "/success",
    "errorUrl": "/error"
}
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/token');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setBody({
    "amount": 25,
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "customerEmail": "info@pgecom.com",
    "customerFirstName": "Esterling",
    "customerLastName": "Accime",
    "successUrl": "/success",
    "errorUrl": "/error"
});
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/token' \
--data-raw '{
    "amount": 25,
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "customerEmail": "info@pgecom.com",
    "customerFirstName": "Esterling",
    "customerLastName": "Accime",
    "successUrl": "/success",
    "errorUrl": "/error"
}'
```

{% endtab %}
{% endtabs %}


# VerifyPGPaymentWithToken

Verify a pg pay a checkout session

## 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 %}


# VerifyPGPaymentWithOrderId

Use the order id to verify if the payment is complete

## Retrieve a order by orderId

<mark style="color:blue;">`GET`</mark> `https://sandbox.pgecom.com/api/order/{orderId}`

#### Headers

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

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

```json
{
    "quantity": 1,
    "receiver": "info@pgecom.com",
    "metadata": {
        "isChatEnabled": true,
        "pgPayMerchantName": "PGecom",
        "isProd": false,
        "customerEmail": "info@pgecom.com",
        "customerFirstName": "Esterling",
        "customerLastName": "Accime",
        "returnUrl": "https://sandbox.pgecom.com/payment/pgpay/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJvcmRlcklkIjoiYjU5YTA5MzktYzgyNC00NzMyLThiMmYtMzZmNDE3NDM3ZTJhIiwiaWF0IjoxNzA0MTQyNDE3LCJleHAiOjE3MDQxNDYwMTd9.JB3oVi3nH0Yw_Q9F1x-1N8bBTkJkRAjoKYq_xIfH7x0?merchantName=PGecom&amount=25"
    },
    "orderId": "b59a0939-c824-4732-8b2f-36f417437e2a",
    "successUrl": "https://sandbox.pgecom.com/payment-success",
    "status": "pending",
    "createdAt": "2024-01-01T20:53:37.155Z",
    "transactionType": "pgpay",
    "sender": "info@pgecom.com",
    "errorUrl": "https://sandbox.pgecom.com/payment-error",
    "paymentStatus": "pending",
    "updatedAt": "2024-01-01T20:53:37.155Z",
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "amount": 25,
    "paymentMethod": "pgpay",
    "id": "b59a0939-c824-4732-8b2f-36f417437e2a",
    "deliveryMethod": "instant",
    "customerId": "87ee04dd-41e8-42e8-b5b9-16c0e4a04c17",
    "customer": {
        "lastName": "Accime",
        "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
        "updatedAt": "2023-09-29T07:01:11Z",
        "createdAt": "2023-09-29T07:01:11Z",
        "id": "87ee04dd-41e8-42e8-b5b9-16c0e4a04c17",
        "email": "info@pgecom.com",
        "phone": "+1 404 825 3444",
        "firstName": "Esterling"
    },
    "shop": {},
    "invoice": {},
    "products": []
}
```

{% endtab %}

{% tab title="401: Unauthorized Unauthorized" %}

```javascript
{
    "message": "jwt malformed - session expired",
    "status": 401
}
```

{% endtab %}

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

```javascript
{
    "message": "Order with id 1ddbb939-a8e9-4c31-85d-1cc5477574a9 not found",
    "status": 400
}
```

{% endtab %}
{% endtabs %}

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

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

let config = {
  method: 'get',
  url: 'https://sandbox.pgecom.com/api/order/b59a0939-c824-4732-8b2f-36f417437e2a',
  headers: { }
};

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

```

{% endtab %}

{% tab title="Python" %}

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

url = URI("https://sandbox.pgecom.com/api/order/b59a0939-c824-4732-8b2f-36f417437e2a")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body

```

{% endtab %}

{% tab title="Ruby" %}

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

url = URI("https://sandbox.pgecom.com/api/order/b59a0939-c824-4732-8b2f-36f417437e2a")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)

response = http.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/order/b59a0939-c824-4732-8b2f-36f417437e2a');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
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/order/b59a0939-c824-4732-8b2f-36f417437e2a'
```

{% endtab %}
{% endtabs %}


# Deprecated

Update your card holder information

<details>

<summary>Update Card Holder</summary>

```
{
    "id": "ich_1LWcstEDjZxHmxzHKG1lH9r1",
    "object": "issuing.cardholder",
    "billing": {
        "address": {
            "city": "Johns Creeks",
            "country": "US",
            "line1": "9700 Medlock Bridge Road",
            "line2": null,
            "postal_code": "97000",
            "state": "GA"
        }
    },
    "company": null,
    "created": 1660468407,
    "email": "omh61313@cdfaq.com",
    "individual": {
        "dob": null,
        "first_name": "Esterling",
        "last_name": "Accime",
        "verification": {
            "document": {
                "back": null,
                "front": null
            }
        }
    },
    "livemode": false,
    "metadata": {
        "balance": "7500.249",
        "email": "omh61313@cdfaq.com",
        "isPrepaid": "true",
        "userID": "bbdf8b70-394a-4dcc-bf0c-c556f1a61109"
    },
    "name": "Esterling Accime",
    "phone_number": null,
    "requirements": {
        "disabled_reason": null,
        "past_due": []
    },
    "spending_controls": {
        "allowed_categories": [],
        "blocked_categories": [],
        "spending_limits": [],
        "spending_limits_currency": null
    },
    "status": "active",
    "type": "individual"
}
```

</details>


# Card Holder

Update your card holder information

<details>

<summary>Update Card Holder</summary>

```
{
    "id": "ich_1LWcstEDjZxHmxzHKG1lH9r1",
    "object": "issuing.cardholder",
    "billing": {
        "address": {
            "city": "Johns Creeks",
            "country": "US",
            "line1": "9700 Medlock Bridge Road",
            "line2": null,
            "postal_code": "97000",
            "state": "GA"
        }
    },
    "company": null,
    "created": 1660468407,
    "email": "omh61313@cdfaq.com",
    "individual": {
        "dob": null,
        "first_name": "Esterling",
        "last_name": "Accime",
        "verification": {
            "document": {
                "back": null,
                "front": null
            }
        }
    },
    "livemode": false,
    "metadata": {
        "balance": "7500.249",
        "email": "omh61313@cdfaq.com",
        "isPrepaid": "true",
        "userID": "bbdf8b70-394a-4dcc-bf0c-c556f1a61109"
    },
    "name": "Esterling Accime",
    "phone_number": null,
    "requirements": {
        "disabled_reason": null,
        "past_due": []
    },
    "spending_controls": {
        "allowed_categories": [],
        "blocked_categories": [],
        "spending_limits": [],
        "spending_limits_currency": null
    },
    "status": "active",
    "type": "individual"
}
```

</details>


# Card Holder Schema

<table><thead><tr><th width="197">Property</th><th width="146">Type</th><th>Description</th></tr></thead><tbody><tr><td>cardHolderId</td><td>string</td><td>Card holder id</td></tr><tr><td>line1</td><td>string</td><td>Card holder line1</td></tr><tr><td>city</td><td>string</td><td>Card holder city</td></tr><tr><td>state</td><td>string</td><td>Card holder state</td></tr><tr><td>country</td><td>string</td><td>Card holder country</td></tr><tr><td>postal_code</td><td>string</td><td>Card holder postal code</td></tr><tr><td>first_name</td><td>string</td><td>Card holder first_name</td></tr><tr><td>last_name</td><td>string</td><td>Card holder last_name</td></tr></tbody></table>


# Update

## Update Card Holder Information

<mark style="color:orange;">`PUT`</mark> `https://sandbox.pgecom.com/api/partner/cardholder`

#### Request Body

| Name                                           | Type   | Description             |
| ---------------------------------------------- | ------ | ----------------------- |
| cardHolderId<mark style="color:red;">\*</mark> | String | Card holder id          |
| line1<mark style="color:red;">\*</mark>        | String | Card holder line1       |
| city<mark style="color:red;">\*</mark>         | String | Card holder city        |
| state<mark style="color:red;">\*</mark>        | String | Card holder state       |
| country<mark style="color:red;">\*</mark>      | String | Card holder country     |
| postal\_code<mark style="color:red;">\*</mark> | String | Card holder postal code |
| first\_name<mark style="color:red;">\*</mark>  | String | Card holder first name  |
| last\_name<mark style="color:red;">\*</mark>   | String | Card holder last name   |
| line2                                          | String | Card holder line2       |

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

```json
{
    "id": "ich_1LWcstEDjZxHmxzHKG1lH9r1",
    "object": "issuing.cardholder",
    "billing": {
        "address": {
            "city": "Johns Creek",
            "country": "US",
            "line1": "9700 Medlock Bridge Road",
            "line2": null,
            "postal_code": "97000",
            "state": "GA"
        }
    },
    "company": null,
    "created": 1660468407,
    "email": "omh61313@cdfaq.com",
    "individual": {
        "dob": null,
        "first_name": "Esterling",
        "last_name": "Accime",
        "verification": {
            "document": {
                "back": null,
                "front": null
            }
        }
    },
    "livemode": false,
    "metadata": {
        "balance": "7500.249",
        "email": "omh61313@cdfaq.com",
        "isPrepaid": "true",
        "userID": "bbdf8b70-394a-4dcc-bf0c-c556f1a61109"
    },
    "name": "Esterling Accime",
    "phone_number": null,
    "requirements": {
        "disabled_reason": null,
        "past_due": []
    },
    "spending_controls": {
        "allowed_categories": [],
        "blocked_categories": [],
        "spending_limits": [],
        "spending_limits_currency": null
    },
    "status": "active",
    "type": "individual"
}
```

{% endtab %}
{% endtabs %}


# Card

A card is either **virtual** or **physical** that you can use to buy business online

The card is accepted&#x20;

* Amazon
* Ebay
* Uber
* Google Ads
* Facebook Ads
* Udemy
* Canva
* Fiver
* Alibaba
* AliExpress
* Shopify
* Godaddy

Or any where Visa is accepted

<details>

<summary>Card Response Example</summary>

```json
// Card Example
{
    "id": "ic_1LVrfdEDjZxHmkzHqsxUEuHe",
    "object": "issuing.card",
    "brand": "Visa",
    "cancellation_reason": null,
    "cardholder": {
        "id": "ich_1LVrf5EDjZxfmxzHaBKaw6v5",
        "object": "issuing.cardholder",
        "billing": {
            "address": {
                "city": "John Creeks",
                "country": "US",
                "line1": "Demo Street",
                "line2": null,
                "postal_code": "90098",
                "state": "GA"
            }
        },
        "company": null,
        "created": 1660286883,
        "email": "ukdgckvdxtqfmbrdea@bvhrs.com",
        "individual": null,
        "livemode": false,
        "metadata": {
            "email": "ukdgckvdxtqfmbrdea@bvhrs.com",
            "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd"
        },
        "name": "John Doe",
        "phone_number": null,
        "requirements": {
            "disabled_reason": null,
            "past_due": []
        },
        "spending_controls": {
            "allowed_categories": [],
            "blocked_categories": [],
            "spending_limits": [],
            "spending_limits_currency": null
        },
        "status": "active",
        "type": "individual"
    },
    "created": 1660286917,
    "currency": "usd",
    "exp_month": 7,
    "exp_year": 2025,
    "financial_account": null,
    "last4": "1714",
    "livemode": false,
    "metadata": {
        "email": "ukdgckvdxtqfmbrdea@bvhrs.com",
        "isPrepaid": "false",
        "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd"
    },
    "replaced_by": null,
    "replacement_for": null,
    "replacement_reason": null,
    "shipping": null,
    "spending_controls": {
        "allowed_categories": null,
        "blocked_categories": null,
        "spending_limits": [
            {
                "amount": 50000,
                "categories": [],
                "interval": "daily"
            }
        ],
        "spending_limits_currency": "usd"
    },
    "status": "active",
    "type": "virtual",
    "wallets": {
        "apple_pay": {
            "eligible": true,
            "ineligible_reason": null
        },
        "google_pay": {
            "eligible": true,
            "ineligible_reason": null
        },
        "primary_account_identifier": null
    },
    "userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd"
}
```

</details>


# Card Schema     &#x20;

<table><thead><tr><th width="197">Property</th><th width="146">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>fullName</code></td><td>string</td><td>Recipient that needs to be on the card</td></tr><tr><td><code>amount</code></td><td>number</td><td>Available mount to spend with the card</td></tr><tr><td>firstName</td><td>string</td><td>First name of the card holder</td></tr><tr><td>lastName</td><td>string</td><td>last name of the card holder</td></tr><tr><td><code>email</code></td><td>string</td><td>Email of the card recipient</td></tr><tr><td><code>billingAddress</code></td><td>object</td><td>Recipient address on the card. The <strong>country</strong> is required inside the billingAddress</td></tr><tr><td><code>isPhysical</code></td><td>boolean</td><td>If set to <strong>true</strong>, then card shipped to the provided address - only shipping for physical USA</td></tr><tr><td><code>person</code></td><td>string</td><td><strong>prepaid</strong>|<strong>user</strong> - user is a registered user on the platform, and prepaid is just temporary prepaid card with a limited amount and limited feature</td></tr><tr><td><code>cardHolderType</code></td><td>string</td><td><strong>business</strong> or <strong>individual</strong>. This defaults to individual if no values pass</td></tr><tr><td><code>bulk</code></td><td>string</td><td>In case we want to receive the card in bulk. This defaults to individual</td></tr></tbody></table>

The billing address object reference above

<table><thead><tr><th width="200">Property</th><th width="122">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>line1</code></td><td>string</td><td>recipient street address</td></tr><tr><td><code>city</code></td><td>string</td><td>recipient city</td></tr><tr><td><code>country</code></td><td>string</td><td>recipient country</td></tr><tr><td><code>state</code></td><td>string</td><td>recipient state</td></tr><tr><td><code>postal_code</code></td><td>string</td><td>recipient postal code</td></tr></tbody></table>


# Retrieve a single card

## Retrieve a single card

<mark style="color:blue;">`GET`</mark> `https://sandbox.pgecom.com/api/card`

#### Query Parameters

| Name         | Type   | Description           |
| ------------ | ------ | --------------------- |
| cardId       | String | the actual card id    |
| cardHolderId | String | The owner of the card |

#### Headers

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

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

```json
{
    "id": "ic_1L94r1EDjZxHmxuHZl60lLeZ",
    "object": "issuing.card",
    "brand": "Visa",
    "cancellation_reason": null,
    "cardholder": {
        "id": "ich_1L94ooEDpZxHmxzHryTvRqDl",
        "object": "issuing.cardholder",
        "billing": {
            "address": {
                "city": "Demo City",
                "country": "US",
                "line1": "9874 Street Address",
                "line2": null,
                "postal_code": "98475",
                "state": "WA"
            }
        },
        "company": null,
        "created": 1654855914,
        "email": "info@pgecom.com",
        "individual": null,
        "livemode": false,
        "metadata": {
            "userID": "5f56dfa3-a415-4818-8275-44fc43ece3fd"
        },
        "name": "PGecom",
        "phone_number": "+14048253444",
        "requirements": {
            "disabled_reason": null,
            "past_due": []
        },
        "spending_controls": {
            "allowed_categories": [],
            "blocked_categories": [],
            "spending_limits": [],
            "spending_limits_currency": null
        },
        "status": "inactive",
        "type": "individual"
    },
    "created": 1654856051,
    "currency": "usd",
    "exp_month": 5,
    "exp_year": 2025,
    "financial_account": null,
    "last4": "0005",
    "livemode": false,
    "metadata": {
        "userID": "5f56dfa3-a415-4818-8275-44fc43ece3fd"
    },
    "replaced_by": null,
    "replacement_for": null,
    "replacement_reason": null,
    "shipping": null,
    "spending_controls": {
        "allowed_categories": [],
        "blocked_categories": [],
        "spending_limits": [
            {
                "amount": 50000,
                "categories": [],
                "interval": "daily"
            }
        ],
        "spending_limits_currency": "usd"
    },
    "status": "active",
    "type": "virtual",
    "wallets": {
        "apple_pay": {
            "eligible": true,
            "ineligible_reason": null
        },
        "google_pay": {
            "eligible": true,
            "ineligible_reason": null
        },
        "primary_account_identifier": null
    }
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```json
{
    "message": "invalid signature"
}
```

{% endtab %}
{% endtabs %}


# List cards

## List cards

<mark style="color:blue;">`GET`</mark> `https://sandbox.pgecom.com/api/card/all`

#### Query Parameters

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| cardHolderId | String |             |

#### Headers

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

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

```json
{
    "object": "list",
    "data": [
        {
            "created": 1655878446,
            "exp_year": 2025,
            "exp_month": 5,
            "status": "inactive",
            "type": "virtual",
            "last4": "0286",
            "spending_controls": {
                "allowed_categories": null,
                "blocked_categories": null,
                "spending_limits": [
                    {
                        "amount": 500,
                        "categories": [],
                        "interval": "daily"
                    }
                ],
                "spending_limits_currency": "usd"
            }
        },
        {
            "created": 1655878007,
            "exp_year": 2025,
            "exp_month": 5,
            "status": "active",
            "type": "virtual",
            "last4": "0278",
            "spending_controls": {
                "allowed_categories": null,
                "blocked_categories": null,
                "spending_limits": [
                    {
                        "amount": 500,
                        "categories": [],
                        "interval": "daily"
                    }
                ],
                "spending_limits_currency": "usd"
            }
        },
        {
            "created": 1655877937,
            "exp_year": 2025,
            "exp_month": 5,
            "status": "active",
            "type": "virtual",
            "last4": "0260",
            "spending_controls": {
                "allowed_categories": null,
                "blocked_categories": null,
                "spending_limits": [
                    {
                        "amount": 500,
                        "categories": [],
                        "interval": "daily"
                    }
                ],
                "spending_limits_currency": "usd"
            }
        },
        {
            "created": 1655877515,
            "exp_year": 2025,
            "exp_month": 5,
            "status": "active",
            "type": "virtual",
            "last4": "0252",
            "spending_controls": {
                "allowed_categories": null,
                "blocked_categories": null,
                "spending_limits": [
                    {
                        "amount": 500,
                        "categories": [],
                        "interval": "daily"
                    }
                ],
                "spending_limits_currency": "usd"
            }
        },
        {
            "created": 1655877464,
            "exp_year": 2025,
            "exp_month": 5,
            "status": "active",
            "type": "virtual",
            "last4": "0245",
            "spending_controls": {
                "allowed_categories": null,
                "blocked_categories": null,
                "spending_limits": [
                    {
                        "amount": 500,
                        "categories": [],
                        "interval": "daily"
                    }
                ],
                "spending_limits_currency": "usd"
            }
        },
        {
            "created": 1655877440,
            "exp_year": 2025,
            "exp_month": 5,
            "status": "active",
            "type": "virtual",
            "last4": "0237",
            "spending_controls": {
                "allowed_categories": null,
                "blocked_categories": null,
                "spending_limits": [
                    {
                        "amount": 500,
                        "categories": [],
                        "interval": "daily"
                    }
                ],
                "spending_limits_currency": "usd"
            }
        },
        {
            "created": 1655877375,
            "exp_year": 2025,
            "exp_month": 5,
            "status": "active",
            "type": "virtual",
            "last4": "0229",
            "spending_controls": {
                "allowed_categories": null,
                "blocked_categories": null,
                "spending_limits": [
                    {
                        "amount": 500,
                        "categories": [],
                        "interval": "daily"
                    }
                ],
                "spending_limits_currency": "usd"
            }
        },
        {
            "created": 1655877354,
            "exp_year": 2025,
            "exp_month": 5,
            "status": "active",
            "type": "virtual",
            "last4": "0211",
            "spending_controls": {
                "allowed_categories": null,
                "blocked_categories": null,
                "spending_limits": [
                    {
                        "amount": 500,
                        "categories": [],
                        "interval": "daily"
                    }
                ],
                "spending_limits_currency": "usd"
            }
        },
        {
            "created": 1655876774,
            "exp_year": 2025,
            "exp_month": 5,
            "status": "active",
            "type": "virtual",
            "last4": "0203",
            "spending_controls": {
                "allowed_categories": null,
                "blocked_categories": null,
                "spending_limits": [
                    {
                        "amount": 500,
                        "categories": [],
                        "interval": "daily"
                    }
                ],
                "spending_limits_currency": "usd"
            }
        },
        {
            "created": 1655876615,
            "exp_year": 2025,
            "exp_month": 5,
            "status": "active",
            "type": "virtual",
            "last4": "0195",
            "spending_controls": {
                "allowed_categories": null,
                "blocked_categories": null,
                "spending_limits": [
                    {
                        "amount": 500,
                        "categories": [],
                        "interval": "daily"
                    }
                ],
                "spending_limits_currency": "usd"
            }
        }
    ],
    "has_more": true,
    "url": "/v1/issuing/cards"
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```json
{
    "message": "invalid signature"
}
```

{% endtab %}
{% endtabs %}


# Create a card

A Visa Business card can be used to purchase any eligible business transactions on Amazon, Ebay, Alibaba, AliExpress, etc

In order to use the create a card endpoint, you'll need to create a customer first

You can take a look at the customer endpoint via this link [Create Customer](/api-endpoint/deprecated/card/create-customer)

Once you've created a customer, you'll need the customer id in order to create a virtual card

Please note that the virtual card can take 24 hours before a user's approval for it.&#x20;

The virtual card is free however there is a fee for applying for the virtual card which is $15 USD to apply for it

The below example gives an example of how to make the request using the endpoint

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

{% endtab %}

{% tab title="Nodejs" %}

```javascript
const axios = require('axios');
let data = '{\n    "customerId": "d97ca351-966c-47e5-a1fa-b8017515763c",\n    "spendingAmount": 2000,\n    "reason": "I wan to buy Products on Amazon",\n    "places": "AliExpress, Amazon, Etc"\n}';

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://sandbox.pgecom.com/api/v1/business/visa',
  headers: { },
  data : data
};

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

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://sandbox.pgecom.com/api/v1/business/visa"

payload = "{\n    \"customerId\": \"d97ca351-966c-47e5-a1fa-b8017515763c\",\n    \"spendingAmount\": 2000,\n    \"reason\": \"I wan to buy Products on Amazon\",\n    \"places\": \"AliExpress, Amazon, Etc\"\n}"
headers = {}

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

print(response.text)

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('http://localhost:3002/api/card');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setBody('{\n    "fullName": "Esterling Accime",\n    "amount": 5,\n    "email": "ukdgckvdxtqfmbrdea@bvhrs.com",\n    "billingAddress": {\n        "line1": "9700 Medlock Bridge Road",\n        "city": "John Creeks",\n        "country": "US",\n        "state": "WA",\n        "postal_code": "90098"\n    },\n    "isPhysical": false,\n    "person": "user"\n}');
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="C#" %}

{% endtab %}
{% endtabs %}

## Create a virtual

<mark style="color:green;">`POST`</mark> `https://sandbox.pgecom.com/api/v1/business/visa`

#### Headers

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

#### Request Body

| Name                                             | Type   | Description                            |
| ------------------------------------------------ | ------ | -------------------------------------- |
| spendingAmount<mark style="color:red;">\*</mark> | String | Monthly spending amount on the card    |
| reason<mark style="color:red;">\*</mark>         | String | Reason why you need this card          |
| places<mark style="color:red;">\*</mark>         | String | Places that you intent to use the card |
| customerID<mark style="color:red;">\*</mark>     | String |                                        |

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

```json
{
    "cardId": "ic_1LVrfdEDjZxHmxzHqsxUEuHe",
    "message": "Virtual Visa card purchased successfully"
    
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```json
{
    "message": "Token not valid"
}
```

{% endtab %}
{% endtabs %}


# Create Customer

## Create a Customer

<mark style="color:green;">`POST`</mark> `https://sandbox.pgecom.com/api/v1/buisness/customer`

#### Headers

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

#### Request Body

| Name                                        | Type    | Description             |
| ------------------------------------------- | ------- | ----------------------- |
| lastName<mark style="color:red;">\*</mark>  | String  | less than 30 characters |
| phone<mark style="color:red;">\*</mark>     | String  |                         |
| id                                          | String  |                         |
| line1                                       | String  |                         |
| line2                                       | String  |                         |
| city<mark style="color:red;">\*</mark>      | String  |                         |
| country                                     | String  |                         |
| state                                       | String  |                         |
| postal\_code                                | String  |                         |
| notes                                       | Boolean |                         |
| userID                                      | String  |                         |
| email<mark style="color:red;">\*</mark>     | String  |                         |
| firstName<mark style="color:red;">\*</mark> | String  |                         |
| createdAt                                   | String  |                         |
| updatedAt                                   | String  |                         |

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

```json

{
    "email": "james@gmail.com",
    "firstName": "James",
    "lastName": "Peter",
    "phone": "+1 404 825 3444",
    "line1": "9700 Medlock Bridge Road",
    "line2": "",
    "city": "Kennewick",
    "country": "United States",
    "state": "WA",
    "postal_code": "993398",
    "notes": "This is simple demo",
    "userID": "6bc4f4cf-d562-4306-9192-a2eaf4fa9789",
    "createdAt": "",
    "updatedAt": "",
    "id": "4a3ce0b8-efdc-4640-ac23-099134d1a881"
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```json
{
    "message": "Token not valid"
}
```

{% endtab %}
{% endtabs %}


# Support

Get help with your PG Rewards API integration

For API-related inquiries or issues, contact <info@pgecom.com>

#### Premium support

For users on enterprise pricing, we have premium integration support available. We'll invite you to our Slack organization and you'll have access to the PG Rewards development team.

####

####


# Production Access

To successfully make requests in production

1. Complete the KYC
2. Submit company documentation

We process full API access requests within 1 business day, but if you are on an expedited timeline, email us at <info@pgecom.com>

{% hint style="info" %}
The production access form requires a form of company documentation- articles of incorporation, a W9, or a bank verification letter. This helps us meet regulatory requirements with regards to Know Your Customer regulations.
{% endhint %}


