API Documentation

API Endpoints & Authentication

All requests to the Pocket API are sent via the HTTP POST method to one of our API endpoint URLs.

All calls to the Pocket API require merchant authentication and merchant access key. Sign up for a account to quickly get started.
Sandbox payment can be also initiated while merchant set the service mode as test in merchant dashboard. It will be live while the mode will be set as active mode.

API Access Key

Register as a merchant in our system. In your merchant dashboard you will find the option for API access key.

Example access key : 51a4bd18-5bc1-4eaa-97b0-c09323398883

Payment Transaction Initiate

The following example code enables you to initiate a payment,depending on how you structure it. The perameter details are also below.

Param Name Param Type Description
custom string Identification of your end Required
amount decimal The amount you want to transaction Required
details string Purchase details Required
web_hook string Instant payment notification url Required
cancel_url string Payment cancel return url Required
success_url string Payment success return url Required
customer_email string Customer email address Required
access_key string Send access_key as bearer token with header Required
                                
    
            <?php
                $parameters = [
                    'custom' => 'DFU80XZIKS',
                    'currency_code' => 'USD',
                    'amount' => 280.00,
                    'details' => 'Digital Product',
                    'web_hook' => 'http://yoursite.com/web_hook.php',
                    'cancel_url' => 'http://yoursite.com/cancel_url.php',
                    'success_url' => 'http://yoursite.com/success_url.php',
                    'customer_email' => 'customer@mail.com',
                ];
                
                $url = 'http://yourwallet.com/payment/process';
                
                $headers = [
                    "Accept: application/json",
                    "Authorization: Bearer access_key",
                ];
                
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
                curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
                curl_setopt($ch, CURLOPT_URL, $url);
                curl_setopt($ch, CURLOPT_POSTFIELDS,  http_build_query($parameters));
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                $response = curl_exec($ch);
                curl_close($ch);
            ?>
    
                            

Example Response after initiating payment

                                
        
        
            //Success Response.
            {
                "code": 200,
                "status": "ok",
                "payment_id": "AIYmQIOAz0GlmsjfhgiOeu304",
                "message": "Your payment has been processed. Please follow the URL to complete the payment.",
                "url":"https://wallet.datgach.vn/process-checkout?payment_id=AIYmQIOAz0GlmsjfhgiOeu304"
            }

            //Error Response.
            {
                "code": 401,
                "status": "error",
                "message": "Invalid API credentials."
            }
            
            
        
                            

Response after successful payment

                                
        
        
            //Success Response.
            {
                "code": 200,
                "status": "ok",
                "payment_id": "AIYmQIOAz0GlmsjfhgiOeu304",
                "transaction": "AIYmQIOAz0G",
                "amount": 100.00,
                "charge": 5.00,
                "currency": "USD",
                "custom": "BVSUZ545XCS",
                "date"  : "22-05-2022"
            }

            
        
                            

Verify Payment

You can verify the payment whether it is valid or not. After successful payment transaction you will have the response where you find the Payment ID. With this payment id and your access key you need make a request to our server for verify the payment. Example code is below.

Payment verify end point : https://wallet.datgach.vn/payment/check-validity

                                
    
            <?php
                $parameters = [
                    'payment_id' => 'AIYmQIOAz0GlmsjfhgiOeu304',
                ]
                
                $url = 'https://wallet.datgach.vn/payment/check-validity';
                
                $headers = [
                    "Accept: application/json",
                    "Authorization: Bearer access_key",
                ];
                
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
                curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
                curl_setopt($ch, CURLOPT_URL, $url);
                curl_setopt($ch, CURLOPT_POSTFIELDS,  $parameters);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                $response = curl_exec($ch);
                curl_close($ch);
            ?>
    
                            

Validity Response

                                
        
        
            //Success Response.
            {
                "code": 200,
                "status": "ok",
                "message": "Transaction is valid",
                
            }

            //Error Response.
            {
                "code": 401,
                "status": "error",
                "message": "Invalid API credentials."
            }

            //or
            {
                "code": 404,
                "status": "error",
                "message": "Transaction not found"
            }

            
        
                            

Supported Currencies

Following currencies are currently supported in our system. It may update furthur.

Currency Name Currency Symbol Currency Code
Sitdown Loyalty Point 1 FDC FDC
Startup Loyalty Point STR STR
Sitdown Loyalty Point 2 HAHA AST
Starbucks STAB STAB
ChainLink LINA LINA
Bitcoin BTCA BTCA
Ethereum ETHA ETHA
Tether USDt USAA USAA
BNBA BNBA BNBA
Solana SOL SOL
XRPA XRPA XRPA
USBB USBB USBB
Cardano ADAA ADAA
Avalanche AVAA AVAA
Dogecoin DOGA DOGA
TRONA TRXA TRXA
Polkadot DOT DOT
Toncoin TON TON