This is the API Documentation for the Bongloy Card Managment System (CMS). The API is written according to the JSON API Specification. For production we recommend installing a JSON API Client for consuming this API.
Account Balance
Retrieve an account balance
Request
Endpoint
GET /v1/accounts/46e8d03e-2ad4-4e12-b901-88c38ff2b3e8/balance
GET /v1/accounts/:account_id/balance
Parameters
None known.
Response
200 OK
{
"data": {
"id": "46e8d03e-2ad4-4e12-b901-88c38ff2b3e8",
"type": "balance",
"attributes": {
"available": [
{
"amount": 1997,
"currency": "USD"
}
],
"pending": [
{
"amount": 791,
"currency": "USD"
}
]
}
}
}
curl -g "https://cms-sandbox.bongloy.com/v1/accounts/46e8d03e-2ad4-4e12-b901-88c38ff2b3e8/balance" -X GET \
-H "Authorization: Bearer E1jVI3OO3qotL5YPewP7EZnQwjV56qmImso4NUMzYoQ"
Accounts
Create an account
Request
Endpoint
POST /v1/accounts
POST /v1/accounts
Parameters
{
"data": {
"type": "account",
"attributes": {
"external_id": "P01-1234567",
"cardholder": "f04ef2ac-1133-4617-aacf-283e6ae4f0b4",
"currency": "USD",
"metadata": {
"foobar": "foobar"
}
}
}
}
Name | Description |
---|---|
cardholder required | The id of the cardholder in which the account will be created for |
currency required | The currency of the account. Only USD is supported at this time |
external_id required | A unique ID for the account set by the issuer. This must uniquely identify the account in the issuers system. |
metadata | Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. |
Response
201 Created
{
"data": {
"id": "9fad0417-6fd2-4cf4-b6fa-a10cbb99ba90",
"type": "account",
"attributes": {
"created_at": "2019-12-11T12:48:43Z",
"updated_at": "2019-12-11T12:48:43Z",
"currency": "USD",
"external_id": "P01-1234567",
"status": "active",
"metadata": {
"foobar": "foobar"
},
"cardholder": "f04ef2ac-1133-4617-aacf-283e6ae4f0b4"
}
}
}
curl "https://cms-sandbox.bongloy.com/v1/accounts" -d '{
"data": {
"type": "account",
"attributes": {
"external_id": "P01-1234567",
"cardholder": "f04ef2ac-1133-4617-aacf-283e6ae4f0b4",
"currency": "USD",
"metadata": {
"foobar": "foobar"
}
}
}
}' -X POST \
-H "Authorization: Bearer rlJjmAwl-cWk6MsaZxIFOcqjuc3c7Ypft0XhdqpGT6A"
List all accounts
Request
Endpoint
GET /v1/accounts
GET /v1/accounts
Parameters
Name | Description |
---|---|
filter[cardholder] | Only return accounts belonging to the Cardholder with the provided ID. |
Response
200 OK
{
"data": [
{
"id": "652a153c-329f-4df1-838a-38e04a4ced9c",
"type": "account",
"attributes": {
"created_at": "2019-12-11T12:48:43Z",
"updated_at": "2019-12-11T12:48:43Z",
"currency": "USD",
"external_id": "8b5ed001-e416-40f8-ac1d-d71c72d88667",
"status": "active",
"metadata": {
},
"cardholder": "32b4e9e8-08c6-4cff-8bc6-2325f9de77ea"
}
},
{
"id": "8624d1c4-5b78-431d-a4c5-ab5b7a1d90c9",
"type": "account",
"attributes": {
"created_at": "2019-12-11T12:48:43Z",
"updated_at": "2019-12-11T12:48:43Z",
"currency": "USD",
"external_id": "f3196dd9-03a7-4552-b003-1f37bef69cdc",
"status": "active",
"metadata": {
},
"cardholder": "6d9cb74f-c47c-4a15-a3c6-e1613e716a96"
}
}
],
"links": {
"prev": "http://example.org/v1/accounts?page%5Bbefore%5D=652a153c-329f-4df1-838a-38e04a4ced9c",
"next": null
}
}
curl -g "https://cms-sandbox.bongloy.com/v1/accounts" -X GET \
-H "Authorization: Bearer oDIN8vyJPYCpSWG_DbpVtG6zEoeeeC7L5v85VxBeHHU"
Retrieve an account
Request
Endpoint
GET /v1/accounts/9bbad17b-2089-4072-a941-9b3b16923495
GET /v1/accounts/:id
Parameters
Name | Description |
---|---|
id required | The id of the account to be retrieved. |
Response
200 OK
{
"data": {
"id": "9bbad17b-2089-4072-a941-9b3b16923495",
"type": "account",
"attributes": {
"created_at": "2019-12-11T12:48:43Z",
"updated_at": "2019-12-11T12:48:43Z",
"currency": "USD",
"external_id": "fd20fcf5-a3a0-437e-83d6-7c56322e7122",
"status": "active",
"metadata": {
},
"cardholder": "e8395758-19b4-4970-93d6-f08170bef2c3"
}
}
}
curl -g "https://cms-sandbox.bongloy.com/v1/accounts/9bbad17b-2089-4072-a941-9b3b16923495" -X GET \
-H "Authorization: Bearer VmiyjOjpg-aXufL7xzNmrNZOWQdWpkdUVL_mqPwDAR0"
Balance Transactions
List all transactions
Request
Endpoint
GET /v1/balance_transactions?filter[account]=69cccd2c-94cc-4369-ba9c-df2d1d2b24ce
GET /v1/balance_transactions
Parameters
filter: {"account"=>"69cccd2c-94cc-4369-ba9c-df2d1d2b24ce"}
Name | Description |
---|---|
filter[account] required | Return cards belonging to the account with the provided ID. |
Response
200 OK
{
"data": [
{
"id": "56a64824-4cf3-4add-922a-1c4d461a5ce0",
"type": "balance_transaction",
"attributes": {
"created_at": "2019-12-11T12:48:43Z",
"updated_at": "2019-12-11T12:48:43Z",
"currency": "USD",
"account": "69cccd2c-94cc-4369-ba9c-df2d1d2b24ce",
"amount": -10000,
"status": "available",
"type": "topup"
}
},
{
"id": "008b1dc2-6c3f-4490-8f0f-476e350e37c1",
"type": "balance_transaction",
"attributes": {
"created_at": "2019-12-11T12:48:43Z",
"updated_at": "2019-12-11T12:48:43Z",
"currency": "USD",
"account": "69cccd2c-94cc-4369-ba9c-df2d1d2b24ce",
"amount": -1000,
"status": "available",
"type": "purchase"
}
}
],
"links": {
"prev": "http://example.org/v1/balance_transactions?filter%5Baccount%5D=69cccd2c-94cc-4369-ba9c-df2d1d2b24ce&page%5Bbefore%5D=56a64824-4cf3-4add-922a-1c4d461a5ce0",
"next": null
}
}
curl -g "https://cms-sandbox.bongloy.com/v1/balance_transactions?filter[account]=69cccd2c-94cc-4369-ba9c-df2d1d2b24ce" -X GET \
-H "Authorization: Bearer T7G8Shr-z5-q6e8vD176kMYaR5iYNG3m2yIheIyIco8"
Retrieve a transaction
Request
Endpoint
GET /v1/balance_transactions/dbe8061b-2534-4a9c-bdd4-c7f81dfd12eb
GET /v1/balance_transactions/:id
Parameters
Name | Description |
---|---|
id required | The id of the transaction to be retrieved. |
Response
200 OK
{
"data": {
"id": "dbe8061b-2534-4a9c-bdd4-c7f81dfd12eb",
"type": "balance_transaction",
"attributes": {
"created_at": "2019-12-11T12:48:44Z",
"updated_at": "2019-12-11T12:48:44Z",
"currency": "USD",
"account": "ac5c2272-2c40-4db8-81f0-179cce928189",
"amount": -1000,
"status": "available",
"type": "purchase"
}
}
}
curl -g "https://cms-sandbox.bongloy.com/v1/balance_transactions/dbe8061b-2534-4a9c-bdd4-c7f81dfd12eb" -X GET \
-H "Authorization: Bearer pJvzRb1FzovEd-zP7QZJn1-GAPwtG_Oxwgz-3-p8kyE"
Cardholders
Create a cardholder
Request
Endpoint
POST /v1/cardholders
POST /v1/cardholders
Parameters
{
"data": {
"type": "cardholder",
"attributes": {
"name": "Tang Dara",
"phone_number": "855715100860",
"additional_details": {
"name_km": "តាំង តារា",
"date_of_birth": "20161220",
"address": "#87, Street 63 (Trasak Paem), Sangkat Boeung Raing, Khan Daun Penh, Phnom Penh, Cambodia",
"location_code": "1201",
"remote_photo_url": "https://via.placeholder.com/150.png",
"remote_identity_document_url": "https://via.placeholder.com/600.png",
"identity_document_number": "123456789",
"identity_document_type": "id_card",
"member_since": "2017"
},
"metadata": {
"foobar": "foobar"
}
}
}
}
Name | Description |
---|---|
name required | The cardholder's name. This will be printed on cards issued to them. |
phone_number required | The cardholder's phone number. This will be transformed to E.164 if it is not provided in that format already. |
metadata | Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. |
Response
202 Accepted
{
"data": {
"id": "721b00c5-59c8-4f68-8c78-01165927aa41",
"type": "cardholder",
"attributes": {
"created_at": "2019-12-11T12:48:44Z",
"updated_at": "2019-12-11T12:48:44Z",
"name": "Tang Dara",
"phone_number": "855715100860",
"additional_details": {
"name_km": "តាំង តារា",
"date_of_birth": "2016-12-20",
"member_since": "2017",
"remote_identity_document_url": "https://via.placeholder.com/600.png",
"remote_photo_url": "https://via.placeholder.com/150.png",
"identity_document_number": "123456789",
"identity_document_type": "id_card",
"address": "#87, Street 63 (Trasak Paem), Sangkat Boeung Raing, Khan Daun Penh, Phnom Penh, Cambodia",
"location_code": "1201"
},
"metadata": {
"foobar": "foobar"
},
"status": "processing_profile"
}
}
}
curl "https://cms-sandbox.bongloy.com/v1/cardholders" -d '{
"data": {
"type": "cardholder",
"attributes": {
"name": "Tang Dara",
"phone_number": "855715100860",
"additional_details": {
"name_km": "តាំង តារា",
"date_of_birth": "20161220",
"address": "#87, Street 63 (Trasak Paem), Sangkat Boeung Raing, Khan Daun Penh, Phnom Penh, Cambodia",
"location_code": "1201",
"remote_photo_url": "https://via.placeholder.com/150.png",
"remote_identity_document_url": "https://via.placeholder.com/600.png",
"identity_document_number": "123456789",
"identity_document_type": "id_card",
"member_since": "2017"
},
"metadata": {
"foobar": "foobar"
}
}
}
}' -X POST \
-H "Authorization: Bearer MZIf7Ubbq62arvk8xMHJ3WZtOfkq_7EOhmURYbo7iU4"
List all cardholders
Request
Endpoint
GET /v1/cardholders
GET /v1/cardholders
Parameters
None known.
Response
200 OK
{
"data": [
{
"id": "2c1f5a11-e449-40a5-9684-e635ecf75039",
"type": "cardholder",
"attributes": {
"created_at": "2019-12-11T12:48:45Z",
"updated_at": "2019-12-11T12:48:45Z",
"name": "Meta Kanha",
"phone_number": "855715100860",
"additional_details": {
"name_km": "មេត្តា កញ្ញា",
"member_since": "2018",
"date_of_birth": "2001-12-11T12:48:45.033Z",
"identity_document_type": "id_card",
"identity_document_number": "P01-2345678"
},
"metadata": {
},
"status": "active"
}
}
],
"links": {
"prev": "http://example.org/v1/cardholders?page%5Bbefore%5D=2c1f5a11-e449-40a5-9684-e635ecf75039",
"next": null
}
}
curl -g "https://cms-sandbox.bongloy.com/v1/cardholders" -X GET \
-H "Authorization: Bearer Knax8Ml_PK9CNWuvKpnmUZN38fPxQ6ihMWr3Qq-GEIU"
Retrieve a cardholder
Request
Endpoint
GET /v1/cardholders/eba5c340-2c77-45bc-b049-f99a9603c61d
GET /v1/cardholders/:id
Parameters
Name | Description |
---|---|
id required | The id of the cardholder to be retrieved. |
Response
200 OK
{
"data": {
"id": "eba5c340-2c77-45bc-b049-f99a9603c61d",
"type": "cardholder",
"attributes": {
"created_at": "2019-12-11T12:48:44Z",
"updated_at": "2019-12-11T12:48:44Z",
"name": "Meta Kanha",
"phone_number": "855715100860",
"additional_details": {
"name_km": "មេត្តា កញ្ញា",
"member_since": "2018",
"date_of_birth": "2001-12-11T12:48:44.981Z",
"identity_document_type": "id_card",
"identity_document_number": "P01-2345678"
},
"metadata": {
},
"status": "active"
}
}
}
curl -g "https://cms-sandbox.bongloy.com/v1/cardholders/eba5c340-2c77-45bc-b049-f99a9603c61d" -X GET \
-H "Authorization: Bearer _65X4NS7vrWOZjZGwCAMmPcBOJPaO9VZT04WxCUjAw8"
Cards
Create a card
Request
Endpoint
POST /v1/cards
POST /v1/cards
Parameters
{
"data": {
"type": "card",
"attributes": {
"type": "physical",
"account": "62cca81c-17ef-4731-adbb-176f62f72655"
}
}
}
Name | Description |
---|---|
currency required | The currency for the card. This currently must be USD . |
type required | The type of card to issue. Possible values are physical or virtual . Only physical is supported at this time. |
account required | The Account ID with which the card will be associated. |
Response
201 Created
{
"data": {
"id": "f96f474a-bf54-4dc0-9fcb-c140c8a47747",
"type": "card",
"attributes": {
"created_at": "2019-12-11T12:48:45Z",
"updated_at": "2019-12-11T12:48:45Z",
"last_four": "0498",
"exp_month": 12,
"exp_year": 2022,
"status": "unactivated",
"account": "62cca81c-17ef-4731-adbb-176f62f72655",
"type": "physical"
}
}
}
curl "https://cms-sandbox.bongloy.com/v1/cards" -d '{
"data": {
"type": "card",
"attributes": {
"type": "physical",
"account": "62cca81c-17ef-4731-adbb-176f62f72655"
}
}
}' -X POST \
-H "Authorization: Bearer n_WF_DGAlz8bBvZm2-KaZV_LPQsUD0uY1DSNVs4kAoM"
List all cards
Request
Endpoint
GET /v1/cards
GET /v1/cards
Parameters
Name | Description |
---|---|
filter[cardholder] | Only return cards belonging to the Cardholder with the provided ID. |
Response
200 OK
{
"data": [
{
"id": "6639a542-ec74-4b49-a0d2-193fea1867ac",
"type": "card",
"attributes": {
"created_at": "2019-12-11T12:48:45Z",
"updated_at": "2019-12-11T12:48:45Z",
"last_four": "2345",
"exp_month": 12,
"exp_year": 2022,
"status": "active",
"account": "ac9ab0af-3f03-4a55-b0e9-408fa5879b8e",
"type": "physical"
}
},
{
"id": "4db124f0-0ef9-4330-8cc9-fba4537d0b7f",
"type": "card",
"attributes": {
"created_at": "2019-12-11T12:48:45Z",
"updated_at": "2019-12-11T12:48:45Z",
"last_four": "2345",
"exp_month": 12,
"exp_year": 2022,
"status": "active",
"account": "c15ca9de-13be-4d35-badf-c7306cd80753",
"type": "physical"
}
}
],
"links": {
"prev": "http://example.org/v1/cards?page%5Bbefore%5D=6639a542-ec74-4b49-a0d2-193fea1867ac",
"next": null
}
}
curl -g "https://cms-sandbox.bongloy.com/v1/cards" -X GET \
-H "Authorization: Bearer 0rAs1WTJjPqhos_caJSvMBMEXaFiH2jfgbxfVlLjXXs"
Retrieve a card
Request
Endpoint
GET /v1/cards/dc8ed5c3-a3cf-4c27-80fc-1d4228765709
GET /v1/cards/:id
Parameters
Name | Description |
---|---|
id required | The id of the card to be retrieved. |
Response
200 OK
{
"data": {
"id": "dc8ed5c3-a3cf-4c27-80fc-1d4228765709",
"type": "card",
"attributes": {
"created_at": "2019-12-11T12:48:45Z",
"updated_at": "2019-12-11T12:48:45Z",
"last_four": "2345",
"exp_month": 12,
"exp_year": 2022,
"status": "active",
"account": "6f316cbd-d4aa-4b55-9d64-a6117a6374b1",
"type": "physical"
}
}
}
curl -g "https://cms-sandbox.bongloy.com/v1/cards/dc8ed5c3-a3cf-4c27-80fc-1d4228765709" -X GET \
-H "Authorization: Bearer mW97Qg21xxWVuKuZzhtIoZm9cqtIV4oWMERy4FDTCGo"
Update a card
Request
Endpoint
PATCH /v1/cards/daf4feea-06b0-45d6-ae40-09ab87aa446b
PATCH /v1/cards/:id
Parameters
{
"status": null,
"data": {
"id": "daf4feea-06b0-45d6-ae40-09ab87aa446b",
"type": "card",
"attributes": {
"status": "inactive"
}
}
}
Name | Description |
---|---|
status | Specifies the status of the card. Possible values are active , inactive , canceled , lost or stolen . Note that once the card is marked as canceled , lost or stolen it cannot be reactivated. |
Response
200 OK
{
"data": {
"id": "daf4feea-06b0-45d6-ae40-09ab87aa446b",
"type": "card",
"attributes": {
"created_at": "2019-12-11T12:48:45Z",
"updated_at": "2019-12-11T12:48:45Z",
"last_four": "2345",
"exp_month": 12,
"exp_year": 2022,
"status": "inactive",
"account": "1baeb9f5-5719-4b72-a396-27b98ea33b7c",
"type": "physical"
}
}
}
curl "https://cms-sandbox.bongloy.com/v1/cards/daf4feea-06b0-45d6-ae40-09ab87aa446b" -d '{
"status": null,
"data": {
"id": "daf4feea-06b0-45d6-ae40-09ab87aa446b",
"type": "card",
"attributes": {
"status": "inactive"
}
}
}' -X PATCH \
-H "Authorization: Bearer qNSghOS1Pbo9fkpsQw93J-adaMSkG23it1TxNM5IE0Y"