PGecom
  • 🚀Introduction
  • đŸŽ¯Guides
    • Getting authenticated
  • 📚Concepts
    • Sandbox Environment
  • 🧑‍đŸ’ģAPI Endpoint
    • Ecommerce
      • đŸ›ī¸Shop
        • GetShopById
        • CreateShop
      • 👔Product
        • ProductSchema
        • GetProductById
        • GetProductBySlug
        • CreateNewProduct
      • 🛒Checkout
        • CreateCheckoutSession
      • Form
        • GetFormById
      • Invoice
        • GetInvoiceById
    • Wordpress Plugin
    • Chrome Extension
    • GiftCards
      • â„šī¸Gift Card Schema
      • ✅List giftcards
      • â˜‘ī¸Order a gift card
      • â˜‘ī¸Get giftcard
      • â˜‘ī¸Rates
    • Send rewards
      • â„šī¸Rewards Schema
      • â˜‘ī¸Send rewards
    • Withdraw
      • â„šī¸Withdraw Schema
      • â˜‘ī¸Process Withdraw
      • â˜‘ī¸Rates
    • Radar
      • â„šī¸Radar Schema
      • â˜‘ī¸Check for Fraudster
    • Top Up
      • â„šī¸Topup Schema
      • â˜‘ī¸Estimate
      • â˜‘ī¸Send
    • Payment
      • Mon Cash
        • CreateMonCashPayment
        • VerifyMonCashPayment
        • WithdrawToMonCashEstimate
        • WithdrawFundsToMonCash
      • PG Pay
        • ConfigurePGPay
        • CreatePGPayPayment
        • VerifyPGPaymentWithToken
        • VerifyPGPaymentWithOrderId
    • Deprecated
      • Card Holder
        • â„šī¸Card Holder Schema
        • â˜‘ī¸Update
      • Card
        • â„šī¸Card Schema
        • ✅Retrieve a single card
        • ✅List cards
        • â˜‘ī¸Create a card
        • â˜‘ī¸Create Customer
  • 🎓Resources
    • Support
    • Production Access
Powered by GitBook
On this page

Was this helpful?

  1. API Endpoint
  2. Payment
  3. Mon Cash

CreateMonCashPayment

Create mon cash payment

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

Request Body

Name
Type
Description

gdes*

Number

Amount in gdes that convert in USD to your account

userID*

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

We send a post a request with the following data to this endpoint once the deposit has finalized

  • orderId

  • status

  • transactionId

  • currency

  • token

{
    "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": ""
}
{
    "message": "Amount should be less than 75000 gdes",
    "status": 400
}
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);
});
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)
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
<?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();
}
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": {}
}'

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}

PreviousMon CashNextVerifyMonCashPayment

Last updated 11 months ago

Was this helpful?

🧑‍đŸ’ģ