CreatePGPayPayment

Create a pg pay a checkout session

Create a pg pay payment request

POST https://sandbox.pgecom.com/api/pgpay/token

Request Body

NameTypeDescription

userID*

String

The receiver that's going to receive the funds

amount*

Number

Amount to charge the customer. Learn more about our fees via this link

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

webhookUrl

string

This can be sent inside the metadata data as metadata.webhookUrl or directly in the payload. This will receive post a request with the following values - orderId - status - transactionId - currency - token

{
    "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"
}
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);
});

Last updated