Field | Description |
---|---|
merchant_id | Your Merchant ID. Please ensure that it is YOUR merchant ID only. |
token | This is a verification token, no need to store it. It can be used to verify the integrity of the API. |
page_hash | A unique identifier for the payment page. |
item_name | It contains identifiable information about the item/service/product being purchased. |
item_desc | It contain more information about the item/service/product being purchased. |
invoice | A string that can be used to identify the order. |
custom | A string that can contain extra information and data about the payment. |
amount1 | The original amount you're charging. It can be decimal like 0.0005 ETH or an integer too. |
currency1 | The currency in which the original amount you're charging. Please find the complete list which can be used as the currency below. |
amount2 | The amount which the user paid. |
currency2 | The currency in which the user paid. |
token
field in every IPN request we send to your IPN URL. Your code must sent a GET request to the following URL (
https://tokenpayments.io/api/token-verifier/TOKEN_SENT_HERE
) to validate the authenticity of every IPN. The token verifier endpoint returns a JSON array with the key
valid
whose value can either be
true
or
false
. You should also check if the
merchant_id
POSTED is yours or not.
<?php define("MERCHANT_ID", "YOUR_MERCHANT_ID_HERE"); $merchant_id = $_POST['merchant_id']; $token = $_POST['token']; $page_hash = $_POST['page_hash']; $item_name = $_POST['item_name']; $invoice = $_POST['invoice']; $custom = $_POST['custom']; $amount1 = $_POST['amount1']; $amount2 = $_POST['amount2']; $currency1 = $_POST['currency1']; $currency2 = $_POST['currency2']; $token_integrity = json_decode(file_get_contents("https://tokenpayments.io/api/token-verifier/" . $token), true)['valid']; if ($token_integrity == true) { if (MERCHANT_ID == $merchant_id) { $order_amount = 100; $order_currency = "USD"; if ($currency1 == $order_currency && $amount1 >= $order_amount) { // Process the order here. } } } else { // Invalid request received, someone is probably attacking the endpoint. } ?>
This helps you setup a payment form so that you can collect payments.
Check Out