• Getting Started

Transaction Verification

Learn how to verify transactions using the transaction ID

After charging your customer, you need to verify if the payment was successful before giving value to your customer. You must issue a transaction ID for every transaction.

Here are some important things to look out for when verifying the payment:

  • Verify the transaction reference
  • Verify the status of the transaction to be successful
  • Verify the currency to be the expected currency
  • Most importantly validate the amount paid to be equal to or at least greater than the amount of the value to be given

Here is a sample code of how to implement server-side validation in different programming languages:


curl --location --request GET 'https://api.coinforbarter.com/v1/transactions/{{transaction_id}}/verify'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer {{PRIVATE_KEY}}'
            

var fetch = require('node-fetch');
fetch('https://api.coinforbarter.com/v1/transactions/{{transaction_id}}/verify', {
     headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer {{PRIVATE_KEY}}'
    }
});
            

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.coinforbarter.com/v1/transactions/{{transaction_id}}/verify');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$headers = array();
$headers[] = 'Content-Type: application/json';
$headers[] = 'Authorization: Bearer {{PRIVATE_KEY}}';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close($ch);

Checkout Modal Customizations

You can make same request from client side using your public key

Payment Endpoint

https://api.coinforbarter.com/v1/transactions/:transaction_id/verify/checkout

Method: GET

Headers: Authorization: Bearer [PUBLIC_KEY]

Verification Response

Here is a simple verification response


{
    "status": "success",
    "message": "transaction fetched",
    "data": {
        "id": "123456",
        "status": "in progress",
        "description": "Payment from anonymous",
        "baseAmount": 0.1,
        "baseCurrency": "BTC",
        "currencies": [
            "BTC",
            "DOGE"
        ],
        "transactionFees": 0,
        "totalDue": 0,
        "customer": "anonymous",
        "addressSentFrom": [],
        "transactionTimeLog": [
            {
                "time": "2021-06-14T16:49:13.079Z",
                "type": "event",
                "event": "Started transaction"
            }
        ],
        "isCurrencyLocked": false,
        "createdAt": "2021-06-14T16:49:13.189Z"
    }
    
}
            

Join Developers Channel on Slack

Join our developers channel to stay up to date on latest news and features. Find answers to your problems and network with other developers. Join Developers Channel.