RESTful APIs

This document is intended to guide partners using APIs for the services provided https://daily.gate.vn

Request Methods

HTTP has multiple request "verbs", such as GET, POST, etc.

An HTTP Method (verb) defines how a request should be interpreted by a server. The endpoints in this section demonstrate various HTTP Verbs. API supports all the HTTP Verbs, including some rarely used ones, such as PROPFIND, UNLINK, etc.

GET GET Request
https://daily.gate.vn/api/get?foo1=bar1&foo2=bar2

The HTTP GET request method is meant to retrieve data from a server. The data is identified by a unique URI (Uniform Resource Identifier).

A GET request can pass parameters to the server using "Query String Parameters". For example, in the following request,

http://example.com/hi/there?hand=wave

The parameter "hand" has the value "wave".

This endpoint echoes the HTTP headers, request parameters and the complete URI requested.

PARAMS

foo1
bar1
foo2
bar2


POST POST Raw Text
https://daily.gate.vn/api/rest

The HTTP POST request method is meant to transfer data to a server (and elicit a response). What data is returned depends on the implementation of the server.

A POST request can pass parameters to the server using "Query String Parameters", as well as the Request Body. For example, in the following request,

POST /hi/there?hand=wave

The parameter "hand" has the value "wave". The request body can be in multiple formats. These formats are defined by the MIME type of the request. The MIME Type can be set using the Content-Type HTTP header. The most commonly used MIME types are:

  • multipart/form-data
  • application/x-www-form-urlencoded
  • application/json

This endpoint echoes the HTTP headers, request parameters, the contents of the request body and the complete URI requested.

BODY

This is expected to be sent back as part of response body.


POST POST Form Data
https://daily.gate.vn/api/rest

The HTTP POST request method is meant to transfer data to a server (and elicit a response). What data is returned depends on the implementation of the server.

A POST request can pass parameters to the server using "Query String Parameters", as well as the Request Body. For example, in the following request,

POST /hi/there?hand=wave

The parameter "hand" has the value "wave". The request body can be in multiple formats. These formats are defined by the MIME type of the request. The MIME Type can be set using the Content-Type HTTP header. The most commonly used MIME types are:

  • multipart/form-data
  • application/x-www-form-urlencoded
  • application/json

This endpoint echoes the HTTP headers, request parameters, the contents of the request body and the complete URI requested when data is sent as a form parameter.

BODY

foo1
bar1
foo2
bar2


Headers

The following set of endpoints allow one to see the headers being sent as part of a request and to get a custom set of headers as part of response.

HTTP header fields provide required information about the request or response, or about the object sent in the message body. Both request headers and response headers can be controlled using these endpoints.

GET Request Headers
https://daily.gate.vn/api/headers

A GET request to this endpoint returns the list of all request headers as part of the response JSON. In Postman, sending your own set of headers through the Headers tab will reveal the headers as part of the response.

HEADERS

my-sample-header
Lorem ipsum dolor sit amet


GET Response Headers
https://daily.gate.vn/api/response-headers?foo1=bar1&foo2=bar2

This endpoint causes the server to send custom set of response headers. Providing header values as part of the URL parameters of a GET request to this endpoint returns the same as part of response header.

To send your own set of headers, simply add or replace the the URL parameters with your own set.

PARAMS

foo1
bar1
foo2
bar2


Authentication Methods

GET Basic Auth
https://daily.gate.vn/api/

This endpoint simulates a basic-auth protected endpoint. The endpoint accepts a default username and password and returns a status code of 200 ok only if the same is provided. Otherwise it will return a status code 401 unauthorized.

Username: [account on https://daily.gate.vn]

Password: password

Password encrypt with RSA Public key length 1024 bit



POST Load card collection from format v1
https://{HOST_DOMAIN}/api/rest
HEADERS

Content-Type
application/json
username
xxxxx
password
2xxxxx
version
v1
routing
load_card
signature
cxxxx
PARAMS

codeType
Enums [GATE,MOBI,VINA,VIETTEL,GARENA,ZING,BEELINE,KASPERSKY,VCOIN,VN MOBI,ECASH]
requestId
Request ID
amount
Card face value to load
quantity
Number of cards to load
BODY

Sample Response

                                                
{
    "balance": 1994639030,
    "cards": [
        {
            "serial": "CA00005779",
            "pin": "5266D3A37FE3DF51623DDD936A7641B1",
            "expireDate": "12/22/2019 2:54:41 PM",
            "saleDate": "12/22/2018 2:54:41 PM"
        },
        {
            "serial": "CA00005780",
            "pin": "665487EE97FC9C5B6BF98F59A1B0AF4D",
            "expireDate": "12/22/2019 2:54:41 PM",
            "saleDate": "12/22/2018 2:54:41 PM"
        }
    ],
    "orderInfo": {
        "status": 1,
        "createDate": "12/22/2018 2:54:40 PM",
        "decription": "Mua thẻ Gate 10000 - Số lượng : 2 thẻ - Hình thức: API - PARTNERTRANSID:81232317238743",
        "quantity": 2,
        "total": 18800,
        "price": 9400,
        "total_buy": 18800,
        "total_sale": 20000,
        "total_profit": 1200
    },
    "code": 0,
    "message": "Thực hiện giao dịch thành công",
    "systemTradeId": "6894FF4BF1B9",
    "requestId": "81232317238743",
    "requestIp": "10.8.37.60",
    "responseTime": "1545490481",
    "signature": "RkgcfVf6AxwoKXgUm+ycXsOboqxnO0fzdPP1RNaA88iIW+3lVrLIUu2eYt74BvmAENekXeQLD0I9RBIdCNMyu4uWpWdf9bUnems8c7RYKx0/feM+a3CFrN85vQcUhBzfJvYP5UlqytbnsIQK2kKBj9zE8s8fgZl/6t9lo/sB4uU="
}
                                            


POST Pay Card collection from format v1
https://{HOST_DOMAIN}/api/rest
HEADERS

Content-Type
application/json
username
xxxxx
password
2xxxxx
version
v1
routing
pay_card
signature
cxxxx
PARAMS

requestId
Request ID
codeType
Enums [GATE]
serialNumber
Serial Number
pinNumber
Pin Number
BODY

Sample Response

                                                
{ 
  CardValue: 100000,
  balance: 487740530,
  orderInfo:
  { status: 1,
    createDate: '2/10/2020 3:21:45 PM',
    decription: 'Giao dich thanh cong ! Gach the  GATE 100000 - vao tai khoan: 0903886637. Hinh thuc API!',
    quantity: 1,
    total: 100000,
    price: 100000,
    total_buy: 100000,
    total_sale: 86000,
    total_profit: 14000 
  },
  code: 0,
  message: 'Giao dich thanh cong',
  systemTradeId: '42622A181F1A',
  requestId: '0829109137728703',
  requestIp: '127.0.0.1',
  responseTime: '1581347854904',
  signature:
   'SoqKO+CHjx4GE/lGZswgm21nmZ9bDJ4QCjLB1AJhs0dUkD1/cbABWxfk6B/6waMwpJNutImI6dD6eqNy5HXJBJOeSI+b5Gxw/DfBKjxfSDgfxFwv6/kwJvrOwnkcK5pS1VuYhDjPASWEw7mywGRGQF0GwKwoy72cTcYUfewKQJg=' 
}
                                            


POST Check balance collection from format v1
https://{HOST_DOMAIN}/api/rest
HEADERS

Content-Type
application/json
username
xxxxx
password
2xxxxx
version
v1
routing
check_balance
signature
cxxxx
PARAMS

requestId
Request ID
BODY

Sample Response

                                                
{
    "balance": 9107000,
    "code": 0,
    "message": "Giao dich thanh cong",
    "systemTradeId": "1545439105682",
    "requestId": "34539845",
    "requestIp": "10.8.37.60",
    "responseTime": "1545439106",
    "signature": "hzE8SEDLYD6d0YvSZYRIcmPafakd7bgBamR29TlJa7DSvvAOmhg5r3WpeSo9kE17TskBiUfDbN6fyazkBkcc1rwuIZbU54UKw+aOCfQjbOQbS+OAGKW57jnu6LnlBvuTSZy2VEFw0esTj0YISYWP65MFgyHpEBdpgpy9V3OjKyQ="
}

                                            


POST ReLoad card collection from format v1
https://{HOST_DOMAIN}/api/rest
HEADERS

Content-Type
application/json
username
xxxxx
password
2xxxxx
version
v1
routing
reload_card
signature
cxxxx
PARAMS

requestId
Request ID
reloadRequestId
Request Id to reload the card
BODY

Sample Response

                                                
{
    "cards": [
        {
            "serial": "CA00005779",
            "pin": "5266D3A37FE3DF51623DDD936A7641B1",
            "expireDate": "12/22/2019 2:54:41 PM",
            "saleDate": "12/22/2018 2:54:41 PM"
        },
        {
            "serial": "CA00005780",
            "pin": "665487EE97FC9C5B6BF98F59A1B0AF4D",
            "expireDate": "12/22/2019 2:54:41 PM",
            "saleDate": "12/22/2018 2:54:41 PM"
        }
    ],
    "orderInfo": {
        "status": 1,
        "createDate": "12/22/2018 2:54:40 PM",
        "decription": "Mua thẻ Gate 10000 - Số lượng : 2 thẻ - Hình thức: API - PARTNERTRANSID:81232317238743",
        "quantity": 2,
        "total": 18800,
        "price": 9400,
        "total_buy": 18800,
        "total_sale": 20000,
        "total_profit": 1200
    },
    "code": 0,
    "message": "Giao dịch thành công",
    "systemTradeId": "6894FF4BF1B9",
    "requestId": "6436873164",
    "requestIp": "10.8.37.60",
    "responseTime": "1545490565",
    "signature": "UB/cAZn+VEkcSDr2UZz07auEX6IkMVwoxRMkkAM8ctS0PsVhXdZZoBjsjhLJMCxFbWUagP8Hst4w8P5mMMpSa2xTbyMwnf2B9PPPhje8iwRksM4bKTNhPQXBHjuEIIbweX+YU06/TDiGa0p8wz0mrNrjb2RTDyNDQoX/J71ccmo="
}   

                                            


POST Topup collection from format v1
https://{HOST_DOMAIN}/api/rest
HEADERS

Content-Type
application/json
username
xxxxx
password
2xxxxx
version
v1
routing
topup
signature
cxxxx
PARAMS

requestId
Request ID
topupType
Mobile or Game
target
Mobile number or character name
targetVendor
Telco or ID Game
amount
Amount value to topup

Decription parameters
TopupType

prepaid
Recharge prepaid mobile subscribers
postpaid
Recharge postpaid mobile subscribers
TargetVendor

VIETTEL
VMS
VINAPHONE
SFONE
VNMOBILE
BEELINE
BODY

Sample Response

                                                
{
    "balance": 1958531410,
    "orderInfo": {
        "status": 1,
        "createDate": "1/23/2019 4:29:22 PM",
        "decription": "Nap tien vao so: 0978883586, Hinh thuc API",
        "quantity": 1,
        "total": 9510,
        "price": 9510,
        "total_buy": 9510,
        "total_sale": 10000,
        "total_profit": 490
    },
    "code": 0,
    "message": "Thuc hien giao dich thanh cong",
    "systemTradeId": "664BE0C900B5",
    "requestId": "81232317238743",
    "requestIp": "113.161.93.54",
    "responseTime": "1548260963",
    "signature": "EoMXM2Q/HdtBm3GQD2i4YJ3vYC4fTy5Ei1wUCozLGR83oMo1Ecd1h63rLdOfHVIJ+jx0id5uYRvEOhCW0Un0ZGEmQ6nAqlFN4ZWn/nFo35+8Du6YAh6CZANJM5HnMHpgjit86adft1YZLje8+tHitLhith08k2Jrb+hzXBQ3CtM="
}

                                            


POST Check request collection from format v1
https://{HOST_DOMAIN}/api/rest
HEADERS

Content-Type
application/json
username
xxxxx
password
2xxxxx
version
v1
routing
check_request
signature
cxxxx
PARAMS

requestId
Request ID
checkRequestId
Request Id to check status
BODY

Sample Response

                                                
{
    "orderInfo": {
        "status": 1,
        "createDate": "12/22/2018 2:54:40 PM",
        "decription": "Mua thẻ Gate 10000 - Số lượng : 2 thẻ - Hình thức: API - PARTNERTRANSID:81232317238743",
        "quantity": 2,
        "total": 18800,
        "price": 9400,
        "total_buy": 18800,
        "total_sale": 20000,
        "total_profit": 1200
    },
    "code": 0,
    "message": "Giao dịch thành công",
    "systemTradeId": "6894FF4BF1B9",
    "requestId": "6436873164",
    "requestIp": "10.8.37.60",
    "responseTime": "1545492636",
    "signature": "UprGgMZFaoBfOJnQECYIeU1P+FiubEDQJ8UonQQVdtBP/rh5d1enExBRKkxpWLKzOoXJ6nVk4mr1J+SZtdM7MpwcC9QalE/fUzAiLiuLdKSGWfftP2ux3F3qtRSGmY4LKDoiSquZ5L/ISQFs5g5lrF8Jjh1Ytbdw6Pt6Du0XiPQ="
}   

                                            


Utilities

Signature

Use the RSA with SHA1 data signature of RSA Private key.

Data input is a sequence of all elements arranged in alphabetical sort by key ex: a=x&b=xx&c=vcc

Request data

String data input sign

                                                
reloadRequestId=81232317238732&requestId=6436873164
                                                


Verify Signature

Use the RSA with SHA1 verify signature for RSA Public key.

Data input is a sequence of all elements arranged in alphabetical sort by key ex: a=x&b=xx&c=vcc

Response data

                                                
{
    "cards": [
        {
            "serial": "CA00005769",
            "pin": "5CD1C1B6CD265B47CEAC15DFF301314C",
            "expireDate": "12/22/2019 12:39:48 AM",
            "saleDate": "12/22/2018 12:39:48 AM"
        },
        {
            "serial": "CA00005770",
            "pin": "FDCA69D808CCB2FACB82478836F433A5",
            "expireDate": "12/22/2019 12:39:48 AM",
            "saleDate": "12/22/2018 12:39:48 AM"
        }
    ],
    "code": 0,
    "message": "Giao dịch thành công",
    "systemTradeId": "1545440125751",
    "requestId": "6436873164",
    "requestIp": "10.8.37.60",
    "responseTime": "1545440126",
    "signature": "cvYem9fTPfN3aSCy/NCUN4LqS9AnxVacELpQQ31c4BvAWYhH7M821rKJMlp11MU4YN8oHa6bDy/yOeiCDrSwbcSB7+/fsuY3ffoSqpgPK2i5DkpHVSOsnSHPHyNfNozZ+qKzKom5eYVbLda9SBXiX9tcFwYLNkLhe5P8k+j1MTQ="
}

                                                
                                            
String message verify sample

                                                
cards=[{"serial":"CA00005769","pin":"5CD1C1B6CD265B47CEAC15DFF301314C","expireDate":"12/22/2019 12:39:48 AM","saleDate":"12/22/2018 12:39:48 AM"},{"serial":"CA00005770","pin":"FDCA69D808CCB2FACB82478836F433A5","expireDate":"12/22/2019 12:39:48 AM","saleDate":"12/22/2018 12:39:48 AM"}]&code=0&message=Giao dịch thành công&requestId=1545440760588&requestIp=10.8.37.60&responseTime=1545440752&systemTradeId=1545440752438
                                                


Error response

Template response with error code

Code 20 Signature invalid

                                                
{
    "dataRequest": {
        "signature": "xICPw4XHF5vtLtqb7m3Xo/3DMBcnzRk561YsBo/y/B0TafzkKQhJKjY8YugxOcTq3TvIAKd1FWla4Dhtur3X/mf2lnxnFWFC9zCHEhDxkOkGbAwC5ilohjPKkWvk3ofR4d+65utK1vT8knMKq18uzUuaSeQY1JX5wHIDoLI7P3/0=",
        "original": "checkRequestId=81232317238743&requestId=6436873164"
    },
    "code": 20,
    "message": "Chữ ký điện tử không hợp lệ.",
    "systemTradeId": "1545493539346",
    "requestId": "6436873164",
    "requestIp": "10.8.37.60",
    "responseTime": "1545493539",
    "signature": "UIOrcqE4coK1V2YyJIk93OJ5Ab+gPlptbQWVFENxzTS3eTXoFpuoLSwxl9pxFqLit2sKQ/aZ6K9ebosDp0lcRLIMQAv4ejCa8oqXNizWT+Cu2qvQbbsNHpfYH8k4kHWohDe56EqIwEyL38W/FnmOV3YAc5Dswq1ZecG+vWpuMhc="
}

                                                
                                            
Request failed response code

                                                
{
    "code": 807,
    "message": "Account does not exist.",
    "systemTradeId": "1545493688407",
    "requestId": "6436873164",
    "requestIp": "10.8.37.60",
    "responseTime": "1545493688",
    "signature": null
}

                                                
                                            
Exception response

                                                
{
    "code": 99,
    "message": "Lỗi hệ thống",
    "systemTradeId": "1545493921007",
    "requestId": "34539845",
    "requestIp": "::1",
    "responseTime": "1545493921",
    "signature": "PamU872pGst6SMAdCH408p3Z29vEndE2L0hPd3w08CYF3LLRkjMM8Y3m+mbUes7k84SSYrQBxWb8VhG381jXAPZa+gKi8i6oyoIzqvyWSJpc5aM03fhDPz19gFtp+Sq7TtnPKEiGOA9GyhjIkKpZzy/RdbDXOahb9tLHtkjPSBs="
}

                                                
                                            


Return Code

Note that if an invalid status code is requested to be sent, the server returns a status code of 0.

LIST CODE

0
Request success
2
Giao dịch đang xử lý vui lòng kiểm tra lại sau (pending).
3
Tham số đầu vào (username) không hợp lệ
5
Tham số đầu vào (password) không hợp lệ
7
Tham số đầu vào (productID) không hợp lệ
8
Số lượng thẻ vượt quá giới hạn
9
Tham số đầu vào (amount) không hợp lệ
11
Tài khoản không tồn tại
12
Ví tài khoản không tồn tại
13
Số lượng thẻ trong kho không đủ
14
Tham số đầu vào (quantity) không hợp lệ
15
Tham số đầu vào (cardName và amount) không hợp lệ
16
Tài khoản không này không thể thực hiện được.
17
Không tìm thấy thông tin tài khoản
19
Thông tin sản phẩm không hợp lệ
21
Tài khoản của quý khách không sử dụng được.
23
Số lượng thẻ trong kho không đủ.
25
Lỗi hệ thống, không thể thực hiện giao dịch
26
Duplicate requestId
202
Số lượng thẻ không hợp lệ.
203
Loại thẻ không hợp lệ.
801
Field 'Field Name' is required
802
Invalid ContentType request
803
Routing not allow or not exist
805
Account is locked
806
IP 'xxxx' does not allow
807
Account does not exist
808
This account is Invalid
809
Encryption password is not correct.
810
Reload request Id `xxxx` find not found.
811
Reload request Id `xxxx` is failed.
812
Tài khoản không đủ tiền để thực hiện giao dịch.
813
Giao dịch đã hết hiệu lực.
814
Loại thẻ không tồn tại.
815
Tạm thời không thể thực hiện giao dịch vui lòng thử lại sao.
816
Bạn đã vượt quá giới hạn thử nghiệm vui lòng liên hệ admin để được hỗ trợ.
817
Tài khoản bị khoá tính năng nạp thẻ.
818
Code `{codeType}` is not allow.
819
Serial Number is not empty.
820
Pin Number is not empty.
998
Request timeout
97
Đối tác không hợp lệ
98
Địa chỉ IP không hợp lệ
99
System exception error
1205
Giao dịch chưa hoàn tất vui lòng kiểm tra lại
1206
Số lượng thẻ không hợp lệ.
1207
Giao dịch thất bại vui lòng thử lại sau.
1208
Thêm đơn hàng thất bại
1209
Thông tin sản phẩm không hợp lệ.


Environment
Production

https://daily.gate.vn/api/rest

Sandbox

Developers please use the information below to develop before going live.

https://developer-daily.gate.vn:17443/api/rest

Username: 0903886637

Password: 123456

RSA Public key

                                                
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCI6T12WztLVpN3yV1JIzbqT4Tc
GohOXOtEjNmSvutblJZSSiesqLbNTPy9prmn1xswECPpO+YaxZkuD8PCQYtI+HGM
i51ICZfxTW6EKiIwFbfy9M4hSvqE5o7W8SgC163+s72WrT1WIVyk6lUfV4u36Wz2
I0qVvZ0ZiQlqWGt8/wIDAQAB
-----END PUBLIC KEY-----

                                                

RSA Private key

                                                
-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQCI6T12WztLVpN3yV1JIzbqT4TcGohOXOtEjNmSvutblJZSSies
qLbNTPy9prmn1xswECPpO+YaxZkuD8PCQYtI+HGMi51ICZfxTW6EKiIwFbfy9M4h
SvqE5o7W8SgC163+s72WrT1WIVyk6lUfV4u36Wz2I0qVvZ0ZiQlqWGt8/wIDAQAB
AoGAJRmHBS59p9GjDl+rfqkjNWUs7HPoIcv+GMpOHvzLTDq8bToY/CmPt5w4FLA8
OOYKQQDuqkIH/ZM0Cg5NjrMyKcDSN/BzUV09cvor3skAd7gSVL2XYpvQrntm+/uC
v0/zhmDUE0b2MNIadTknDM6uvIAueGJBfSq3IVYCz78ZBTkCQQDqnPGfvqV/fBWw
SGHDJBfVk+2C6uZQM1NF6MUrLi+Ci9YxR+49fT4DiIzrOCzdcnpvhIY1/3QdmAm2
w9YqswuFAkEAlWRFUGmDjZmZR8xxh4J5STxqHzboa7Pqmj3bMK5oWNrbFJDX8tXv
uIdXpTc9unC5N7pjB3zfSIPbffgsLI5jswJAGakQxGgVsdvgg2dnSfCoqrODRs5q
Yls6wGq1JgPnLmAdDUbQx+jq33gP8aozPgVHXusfwsgt6w62AUdqJUFwAQJAR1Wv
+2vG05Cqrqwi8fANdjkQ+4K+jN9GgQxUY/SEAxnOTw2y8FPTuit2YH/2S9aTutaX
fvXTsM61unsMrOH5HQJBALvwC7glJMe+ZkZubg188LB5c5gchrqiEr4JQH/1N0dF
ILNTMRQ6bUFVdpHKG6gUYZVSNAtQNeZfh/fmKvd0Ds8=
-----END RSA PRIVATE KEY-----
                                                                                                                                    



Sample Code

dotNet
PHP
NodeJS
Java