Transactions API

URL: https://www.oncpay.com/api/transactions

Name Value Method
apiKey Your account API key GET

API Sample Code PHP


$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.oncpay.com/api/transactions?apiKey= YOUR API KEY",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

API Response

				
{
    "transactions": [
        {
            "hash": "0xf2c28c342859d618655cf7051f2842864a367ea29a0f533e21ce9734335dc26d",
            "transactionType": "deposit",
            "amount": "1.00000000",
            "confirmations": "33",
            "status": "complete",
            "coinName": "ONC Cash"
        }
    ],
    "status": "success"
}
				
				

Deposit API

URL: https://www.oncpay.com/api/deposit

Name Value Method
apiKey Your account API key GET

API Sample Code PHP


$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.oncpay.com/api/deposit?apiKey=YOUR API KEY",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

API Response

				
{
    "address": "YOUR DEPOSIT WALLET ADDRESS",
    "balance": "0.00000000",
    "status": "success"
}
				
            

Create Invoice API

URL: https://www.oncpay.com/api/generate_invoice

Name Value Method
apiKey Your account API key GET
amount Amount in numeric GET
itemName Item Name. GET
storeName Store Name. GET

API Sample Code PHP


$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.oncpay.com/api/generate_invoice?apiKey=e7qSsOognyMNBXIKTWkubtfFJ4G1Q8xhp2jR3dEz&itemName=Test%20item&storeName=Test%20Store&amount=100",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Content-Type: multipart/form-data; boundary=--------------------------396303362718500526460313"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

API Response

				
{
    "message": "Invoice created successfully",
    "status": "success",
    "data": {
        "invoiceHash": "xlwIQ45SNeGX0d6u79pM1YvfTZjBJohszKDEmR2k",
        "storeName": "Test Store",
        "itemName": "Test item",
        "amount": "100.00000000",
        "status": "unpaid",
        "dateAdded": "2020-03-20 11:33:17"
    }
}
				
            

Check Invoice Status API

URL: https://www.oncpay.com/api/check_invoice_status

Name Value Method
invoiceHash Invoice hash GET

API Sample Code PHP


$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.oncpay.com/api/check_invoice_status?invoiceHash=YOUR INVOICE HASH",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

API Response

				
{
    "message": "Invoice found",
    "status": "success",
    "data": {
        "invoiceHash": "xlwIQ45SNeGX0d6u79pM1YvfTZjBJohszKDEmR2k",
        "storeName": "Test Store",
        "itemName": "Test item",
        "amount": "100.00000000",
        "status": "unpaid",
        "dateAdded": "2020-03-20 11:33:17"
    }
}
				
            

Get Invoices API

URL: https://www.oncpay.com/api/get_invoices

Name Value Method
apiKey Your account API key GET

API Sample Code PHP


$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.oncpay.com/api/get_invoices?apiKey=YOUR API KEY",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

API Response

				
{
    "invoices": [
        {
            "invoiceHash": "xlwIQ45SNeGX0d6u79pM1YvfTZjBJohszKDEmR2k",
            "storeName": "Test Store",
            "itemName": "Test item",
            "amount": "100.00000000",
            "status": "unpaid",
            "dateAdded": "2020-03-20 11:33:17",
            "nameReceiver": "ONC PAY",
            "nameSender": null
        }
    ],
    "status": "success"
}
				
            

Withdraw API

URL: https://www.oncpay.com/api/withdraw

Name Value Method
apiKey Your account API key GET
amount Amount in numeric GET
address Wallet address. GET

API Sample Code PHP


$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.oncpay.com/api/withdraw?apiKey=YOUR API KEY&amount=10&address=Receiver ADDRESS",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

API Response

				
{
    "balance": 9877,
    "message": "Withdraw request submitted successfully!",
    "status": "success"
}
				
            
*