Instructions for integrating API to change cards in English

Ngày đăng: 08-05-2019 Đã xem: 1984

GUIDE TO CHANGE CARD API V2

Download API documentation

  • SEND CARD

1.1 The new API system is committed to not hanging cards, not making LAG partner websites when having a large number of cards at the same time

1.2  The meaning:

  • https://naptudong.com is a website provides a slow card removal API that you want to connect.
  • partner_id & partner_key are granted from customer care on the website: https://naptudong.com

1.2 Connection configuration information:

Open file config.php and fill up value, with this example we have the value given as follows:

        $url = 'https://naptudong.com/chargingws/v2';

        $partner_id = '7908566351';

        $partner_key = '9da6fab8bb728a5b024b3126f53a90ef';

 

Information of sending scratchcard code via API includes:

telco

Service providers – Base on website supporting

Mandatory

code

Scratchcard Code

Mandatory

serial

Scratchcard Serial

Mandatory

amount

Scratchcard value

Mandatory (If it is a fast card change, it is not required, for example GATE)

partner_id

API connection code issued by the website

Mandatory

sign

Security encryption (Note: Only Service providers are uppercase, other characters are lowercase, must correct in order)

Mandatory

command

Order

Mandatory

request_id

Our transaction ID

Mandatory

 

Telco format: VIETTEL, VINAPHONE, MOBIFONE. Please send the correct format in uppercase.

For example, information sending is as follows:

$datapost['telco'] = 'VIETTEL';

$datapost['code'] = '9999999999999';

$datapost['serial'] = '6666666666';

$datapost['amount'] = '100000';

$datapost['request_id'] = '1234';

$datapost['partner_id'] = '15857545515';

$datapost['command'] = 'charging';

$datapost['sign'] = '34fkdsjhgdsfl34238dfdjh34dfd2e';

 

Note: command is the command send to the system

Change Card -> command = charging

Check Card -> command = check

After successfully uploading, the system will return to you the result in Json format as follows:

stdClass Object

(

    [status] => 99

    [message] => Thẻ đã gửi thành công và đang chờ xử lý

    [code] => 9999999999999

    [serial] => 10001796141928

    [telco] => VIETTEL

    [declared_value] => 100000

    [value] =>

    [receive_amount] =>

    [request_id] => 817633220

    [trans_id] => 64

    [sign] =>

)

 

declared_value  : is the value you declare to us

value: is the real denomination that we check

(Thẻ đã gửi thành công và đang chờ xử lý: Card sent successfully and pending for processing)

1.4 States

Here only the main status are provided, while the other status are error messages.  

Status

            ///99 = PENDING

    /// 1 = THE CARD IS CORRECT

    /// 2 = INCORRECT VALUE

    /// 3 = CARD ERROR

    /// 4 = MAINTENANCE

  • - Actual log template of states:
  • + Card pending:
  • {"status":99,"message":"Th\u1ebb \u0111ang ch\u1edd x\u1eed l\u00fd","request_id":"43950","declared_value":20000,"value":null,"amount":12600,"code":"816815546262524","serial":"10002136142286","telco":"VIETTELAUTO","trans_id":269767,"callback_sign":"1974535b6f38716f49b1cc3d1bed1b9c"}
  • + Card correct:
  • {"status":1,"message":"Th\u1ebb \u0111\u00fang","request_id":"32051","declared_value":50000,"value":50000,"amount":36500,"code":"614874611547206","serial":"10001197841955","telco":"VIETTELAUTO","trans_id":269752,"callback_sign":"1ddeae26472328327ed7ef944be34daf"}
  • + Card incorrect value: Declaring value of 20k but 10k denominated reality
  • {"status":2,"message":"Th\u1ebb sai m\u1ec7nh gi\u00e1","request_id":"890676711","declared_value":20000,"value":"10000","amount":4410,"code":"716527274724352","serial":"10003945623426","telco":"VIETTELAUTO","trans_id":269629,"callback_sign":"1fd0f2b14ff39e612ee411b4968df077"}
  • + Card error: wrong Scratchcard code or card used.
  • {"status":3,"message":"Th\u1ebb l\u1ed7i","request_id":"75860","declared_value":50000,"value":0,"amount":0,"code":"213220993383378","serial":"10002043319423","telco":"VIETTELAUTO","trans_id":269627,"callback_sign":"bfcb25c8e10844ee98bbad4a48ba24f5"}
  • + Maintenance: system error or network error
  • {"status":4,"message":"B\u1ea3o tr\u00ec","request_id":"355498359","declared_value":50000,"value":0,"amount":0,"code":"940210495104805","serial":"10004940041805","telco":"VIETTELAUTO","trans_id":269781,"callback_sign":"32452065db9c2099aa7376386d91d3d0"}

 

  • CALL BACK

The system provides you with a utility to return the result of card removal via POST. After the admin successfully processed the card, the system will post the result information about your website including the following data:

        array(

            'status'] = 1;

            'message'] = 'Thẻ đúng',

            'value'] =  '100000',

            'amount'] = '65000',

            'code'] = '76532234',

            'serial'] = '123567',

             'request_id' = '324234',

            'telco'] = 'VIETTEL',

        )

 

(correct card: The card is correct)

You must send to admin Naptudong.com the link to receive the result call back so that admin can attached to the system. Example: http://yourwebsite.com/callback.php

callback_sign is the signature that confirms the owner receives the result. The way to create sign has instructions in the file callback.php

Status:

1 => The card is correct

2 => The card is correct but incorrect value

3 => The card cannot be used

99 => Card pending processing

 

 

Thank you!