Create Payment Order
Method | Endpoint |
---|---|
POST | https://mainnet-api.nakawallet.com/api/transaction/create-payment |
Request Header
Data | Type | Description | Example |
---|---|---|---|
Token | String | Private Key in NAKA Wallet | JWT Format |
Merchant | String | Merchant id in NAKA Wallet | 1234 |
Content-Type | String | - | application/json |
Request Body
Data | Type | Require | Description | Example |
---|---|---|---|---|
data-raw.amount | String | true | Payment amount | 500 |
data-raw.ref_id | String | true | Your order reference id | 1234 |
data-raw.call_back_url | String | true | User call back url | www.example.com/callback |
data-raw.meta_data | Object | false | Optional user reference |
Request Example
curl --location 'https://mainnet-api.nakawallet.com/api/transaction/create-payment' \
--header 'merchant;' \
--header 'token;' \
--header 'Content-Type: application/json' \
--data-raw '{
"amount": 100,
"ref_id": "12345",
"call_back_url":"www.example.com",
"meta_data" : {
"user_name" : "example",
"email" : "[email protected]"
}
}'
Ex. response json body
Case: HTTP status 200 OK body status: true in a case successfully.
{
"status": true,
"data": {
"provider_id": "6704d670af75277466e91489",
"ref_id": "12345wew",
"type": "deposit",
"mode": "receive_pay",
"call_back_url": "www.example.co.th",
"currency": "THB",
"base_amount": 0,
"amount": 100,
"token_status": true,
"meta_data": {
"user_name": "example",
"email": "[email protected]"
},
"is_active": true,
"created_at": "2024-10-24T04:17:51.670Z",
"updated_at": "2024-10-24T04:17:51.670Z",
"id": "6720902ab2025c31dc5a6027",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NzA0ZDY3MGFmNzUyNzc0NjZlOTE0ODkiLCJyZWZfa***************************************AwLCJtaW5fZGVwb3NpdCI6M***************************************TAwLCJjdXJyZW5jeSI6IlRIQiIsIm1vZGUiOiJyZWNlaXZlX3BheSIsImlhdCI6MTczMDE4NzMwNiwiZXhwIjoxNzMwMTg5MTA2fQ.GGUUxkZ3FJD_TEJGAgNI4Ae_K92j7ToZoPncwTUnQms",
"expires_in": 1800,
"url": "https://naka-wallet-testnet.naka.bot/checkout?token=******************************************************************************iLCJyZWZfaWQiOiI2NzIwOTAyYWIyMDI1YzMxZGM1YTYwMjciLCJ0eXBlIjoiZGVwb3NpdCIsImFtb3VudCI6MTAwLCJtaW5fZGVwb3Npd******************************************************************************GUiOiJyZWNlaXZlX3BheSIsImlhdCI6MTczMDE4NzMwNiwiZXhwIjoxNz***************************************ncwTUnQms"
},
"message": "create transaction success."
}
Case: HTTP status 401 Unauthorized status: false in case unauthorized.
Headers:
{
"content-length": "26",
"content-type": "application/json; charset=utf-8"
}
URL:
Data:
{
"message": "Unauthorized"
}
Headers:
{
"content-length": "23",
"content-type": "application/json; charset=utf-8"
}
URL:
Data:
{
"message": "Key wrong"
}
Case: HTTP status 500 Unauthorized status: false in case Internal Server Error.
Headers:
{
"content-length": "70",
"content-type": "application/json; charset=utf-8"
}
URL:
Data:
{
"message": "Error: Can not create transaction(ref_id already exists)"
}