NAV Navbar
JSON cURL

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/9bbdc465-1dbf-4676-b6c6-676303648b88/balance

GET /v1/accounts/:account_id/balance

Parameters

None known.

Response


200 OK
{
  "data": {
    "id": "9bbdc465-1dbf-4676-b6c6-676303648b88",
    "type": "balance",
    "attributes": {
      "available": [
        {
          "amount": 2685,
          "currency": "USD"
        }
      ],
      "pending": [
        {
          "amount": 948,
          "currency": "USD"
        }
      ]
    }
  }
}
curl -g "https://cms-sandbox.bongloy.com/v1/accounts/9bbdc465-1dbf-4676-b6c6-676303648b88/balance" -X GET \
    -H "Authorization: Bearer LYJzQ0V_SSODNd1naFciuWykxZX4i3FrhYdic7pVL_w"

Accounts

Create an account

Request

Endpoint

POST /v1/accounts

POST /v1/accounts

Parameters

{
  "data": {
    "type": "account",
    "attributes": {
      "external_id": "P01-1234567",
      "cardholder": "cdaed453-e42e-4cc8-b2fa-c86146127272",
      "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": "7aec9fdf-02df-45ad-8f7a-58ff63e2a8cf",
    "type": "account",
    "attributes": {
      "created_at": "2019-08-16T09:49:03Z",
      "updated_at": "2019-08-16T09:49:03Z",
      "currency": "USD",
      "external_id": "P01-1234567",
      "status": "active",
      "metadata": {
        "foobar": "foobar"
      },
      "cardholder": "cdaed453-e42e-4cc8-b2fa-c86146127272"
    }
  }
}
curl "https://cms-sandbox.bongloy.com/v1/accounts" -d '{
  "data": {
    "type": "account",
    "attributes": {
      "external_id": "P01-1234567",
      "cardholder": "cdaed453-e42e-4cc8-b2fa-c86146127272",
      "currency": "USD",
      "metadata": {
        "foobar": "foobar"
      }
    }
  }
}' -X POST \
    -H "Authorization: Bearer 0UDbvaXaxv1K-vP3EYyvJJiCifYIPQr-kfXfCyMxar8"

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": "7f9af3f0-cb9b-4db7-8ab6-7cad0c255d4c",
      "type": "account",
      "attributes": {
        "created_at": "2019-08-16T09:49:03Z",
        "updated_at": "2019-08-16T09:49:03Z",
        "currency": "USD",
        "external_id": "b520cd15-cf45-431e-be74-f6240a115d71",
        "status": "active",
        "metadata": {
        },
        "cardholder": "61c45a4c-ef68-4ec1-9bf5-067fb1fcd5bd"
      }
    },
    {
      "id": "69cd6ab9-ce53-4920-8d88-5e454f7308c4",
      "type": "account",
      "attributes": {
        "created_at": "2019-08-16T09:49:03Z",
        "updated_at": "2019-08-16T09:49:03Z",
        "currency": "USD",
        "external_id": "b0ba652e-78d2-4e99-a7ae-c89e71d28c4f",
        "status": "active",
        "metadata": {
        },
        "cardholder": "49959221-3562-470c-a8de-5a1e6d67d6ec"
      }
    }
  ],
  "links": {
    "prev": "http://example.org/v1/accounts?page%5Bbefore%5D=7f9af3f0-cb9b-4db7-8ab6-7cad0c255d4c",
    "next": null
  }
}
curl -g "https://cms-sandbox.bongloy.com/v1/accounts" -X GET \
    -H "Authorization: Bearer frEEkYDnNhUVO-D90Nbyn3xNq3hEX6wdnUsW1YHq8W4"

Retrieve an account

Request

Endpoint

GET /v1/accounts/2077d1dd-050c-4984-ad3a-7e9af0d91654

GET /v1/accounts/:id

Parameters

Name Description
id required The id of the account to be retrieved.

Response


200 OK
{
  "data": {
    "id": "2077d1dd-050c-4984-ad3a-7e9af0d91654",
    "type": "account",
    "attributes": {
      "created_at": "2019-08-16T09:49:03Z",
      "updated_at": "2019-08-16T09:49:03Z",
      "currency": "USD",
      "external_id": "15ad9d8e-b77f-4dc2-8f24-994adf3bd193",
      "status": "active",
      "metadata": {
      },
      "cardholder": "87413554-8847-4fd4-ba7a-d20b1faae210"
    }
  }
}
curl -g "https://cms-sandbox.bongloy.com/v1/accounts/2077d1dd-050c-4984-ad3a-7e9af0d91654" -X GET \
    -H "Authorization: Bearer BdHVv_bO-rYPgCRLF97-wI5bOS82UiWNfRUdOv26zh0"

Balance Transactions

List all transactions

Request

Endpoint

GET /v1/balance_transactions?filter[account]=82b429ec-0676-4dfc-af88-4fa5c604c3df

GET /v1/balance_transactions

Parameters

filter: {"account"=>"82b429ec-0676-4dfc-af88-4fa5c604c3df"}
Name Description
filter[account] required Only return cards belonging to the account with the provided ID.

Response


200 OK
{
  "data": [
    {
      "id": "6fb2dac6-547d-4892-910e-e6c2b49a9178",
      "type": "balance_transaction",
      "attributes": {
        "created_at": "2019-08-16T09:49:03Z",
        "updated_at": "2019-08-16T09:49:03Z",
        "currency": "USD",
        "account": "82b429ec-0676-4dfc-af88-4fa5c604c3df",
        "amount": -1000,
        "type": "purchase"
      }
    },
    {
      "id": "cd5e4f3d-4cb9-4033-9e07-fd185594a215",
      "type": "balance_transaction",
      "attributes": {
        "created_at": "2019-08-16T09:49:03Z",
        "updated_at": "2019-08-16T09:49:03Z",
        "currency": "USD",
        "account": "82b429ec-0676-4dfc-af88-4fa5c604c3df",
        "amount": -1000,
        "type": "purchase"
      }
    }
  ],
  "links": {
    "prev": "http://example.org/v1/balance_transactions?filter%5Baccount%5D=82b429ec-0676-4dfc-af88-4fa5c604c3df&page%5Bbefore%5D=6fb2dac6-547d-4892-910e-e6c2b49a9178",
    "next": null
  }
}
curl -g "https://cms-sandbox.bongloy.com/v1/balance_transactions?filter[account]=82b429ec-0676-4dfc-af88-4fa5c604c3df" -X GET \
    -H "Authorization: Bearer fAMHgFW1T0NVUyRkmBUvcuEiVQAqF70FQdo2O5IOTnw"

Retrieve a transaction

Request

Endpoint

GET /v1/balance_transactions/4b774061-bb04-422f-8d31-003a0f300931

GET /v1/balance_transactions/:id

Parameters

Name Description
id required The id of the transaction to be retrieved.

Response


200 OK
{
  "data": {
    "id": "4b774061-bb04-422f-8d31-003a0f300931",
    "type": "balance_transaction",
    "attributes": {
      "created_at": "2019-08-16T09:49:03Z",
      "updated_at": "2019-08-16T09:49:03Z",
      "currency": "USD",
      "account": "67df95bb-e3f4-47e0-8747-830b1bdf0daf",
      "amount": -1000,
      "type": "purchase"
    }
  }
}
curl -g "https://cms-sandbox.bongloy.com/v1/balance_transactions/4b774061-bb04-422f-8d31-003a0f300931" -X GET \
    -H "Authorization: Bearer TAPcIi9AUiJwLJMflimJfNi0uhqhvLINh7qM6yWLFhI"

Card Network Purchase

Create a purchase

Request

Endpoint

POST /card_network/v1/purchases

POST /card_network/v1/purchases

Parameters

{
  "data": {
    "type": "purchase",
    "attributes": {
      "amount": 1000,
      "currency": "USD",
      "pan": "6200000075620315",
      "cvv2": "123",
      "exp_month": 1,
      "exp_year": 20,
      "card_network_transaction_id": "1111111111111",
      "card_network_transaction_details": {
        "foo": "bar"
      }
    }
  }
}

None known.

Response


201 Created
{
  "data": {
    "id": "d464a26d-9946-4266-ae76-40ef30c63828",
    "type": "purchase",
    "attributes": {
      "created_at": "2019-08-16T09:49:02Z",
      "updated_at": "2019-08-16T09:49:02Z"
    }
  }
}
curl "https://cms-sandbox.bongloy.com/card_network/v1/purchases" -d '{
  "data": {
    "type": "purchase",
    "attributes": {
      "amount": 1000,
      "currency": "USD",
      "pan": "6200000075620315",
      "cvv2": "123",
      "exp_month": 1,
      "exp_year": 20,
      "card_network_transaction_id": "1111111111111",
      "card_network_transaction_details": {
        "foo": "bar"
      }
    }
  }
}' -X POST \
    -u card_network_switch:card_network_switch_password

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": "20170125"
      },
      "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


201 Created
{
  "data": {
    "id": "408a0829-481d-4480-8d97-fd8c89de837f",
    "type": "cardholder",
    "attributes": {
      "created_at": "2019-08-16T09:49:03Z",
      "updated_at": "2019-08-16T09:49:03Z",
      "name": "Tang Dara",
      "phone_number": "855715100860",
      "additional_details": {
        "name_km": "តាំង តារា",
        "date_of_birth": "2016-12-20",
        "member_since": "2017-01-25",
        "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"
      }
    }
  }
}
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": "20170125"
      },
      "metadata": {
        "foobar": "foobar"
      }
    }
  }
}' -X POST \
    -H "Authorization: Bearer x9peZOdLpNXaC0JK2D8C3_aEu5HiJ32crCElUjIZqog"

List all cardholders

Request

Endpoint

GET /v1/cardholders

GET /v1/cardholders

Parameters

None known.

Response


200 OK
{
  "data": [
    {
      "id": "33b336a7-6220-4836-b088-27db7aca0176",
      "type": "cardholder",
      "attributes": {
        "created_at": "2019-08-16T09:49:04Z",
        "updated_at": "2019-08-16T09:49:04Z",
        "name": "Meta Kanha",
        "phone_number": "855715100860",
        "additional_details": {
          "name_km": "មេត្តា កញ្ញា",
          "member_since": "2018-08-16T09:49:04.166Z",
          "date_of_birth": "2001-08-16T09:49:04.166Z",
          "identity_document_type": "id_card",
          "identity_document_number": "123456789"
        },
        "metadata": {
        }
      }
    }
  ],
  "links": {
    "prev": "http://example.org/v1/cardholders?page%5Bbefore%5D=33b336a7-6220-4836-b088-27db7aca0176",
    "next": null
  }
}
curl -g "https://cms-sandbox.bongloy.com/v1/cardholders" -X GET \
    -H "Authorization: Bearer 1RJCHU8niEW6Zxe9McbO7QpRlAzHCuZKLFx5HFVP6bQ"

Retrieve a cardholder

Request

Endpoint

GET /v1/cardholders/5411337b-451b-449f-9b5f-51e03e645e76

GET /v1/cardholders/:id

Parameters

Name Description
id required The id of the cardholder to be retrieved.

Response


200 OK
{
  "data": {
    "id": "5411337b-451b-449f-9b5f-51e03e645e76",
    "type": "cardholder",
    "attributes": {
      "created_at": "2019-08-16T09:49:04Z",
      "updated_at": "2019-08-16T09:49:04Z",
      "name": "Meta Kanha",
      "phone_number": "855715100860",
      "additional_details": {
        "name_km": "មេត្តា កញ្ញា",
        "member_since": "2018-08-16T09:49:04.139Z",
        "date_of_birth": "2001-08-16T09:49:04.139Z",
        "identity_document_type": "id_card",
        "identity_document_number": "123456789"
      },
      "metadata": {
      }
    }
  }
}
curl -g "https://cms-sandbox.bongloy.com/v1/cardholders/5411337b-451b-449f-9b5f-51e03e645e76" -X GET \
    -H "Authorization: Bearer fja9G31heXZQ5tbRKQNuSzLxXxla72SbwaH4msobe5s"

Cards

Create a card

Request

Endpoint

POST /v1/cards

POST /v1/cards

Parameters

{
  "data": {
    "type": "card",
    "attributes": {
      "type": "physical",
      "account": "8f1adb93-61ab-4351-a122-19d8802e839f"
    }
  }
}
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": "83547764-a729-4b53-ba57-52d4cdac55ec",
    "type": "card",
    "attributes": {
      "created_at": "2019-08-16T09:49:04Z",
      "updated_at": "2019-08-16T09:49:04Z",
      "type": "physical",
      "last_four": "3697",
      "exp_month": 8,
      "exp_year": 2022,
      "status": "unactivated",
      "account": "8f1adb93-61ab-4351-a122-19d8802e839f"
    }
  }
}
curl "https://cms-sandbox.bongloy.com/v1/cards" -d '{
  "data": {
    "type": "card",
    "attributes": {
      "type": "physical",
      "account": "8f1adb93-61ab-4351-a122-19d8802e839f"
    }
  }
}' -X POST \
    -H "Authorization: Bearer F1nJ4j6Blv8_gEHI6PS7PzEPvkCJn9B6Vk5JAQvfvyY"

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": "070faceb-e978-40e5-a768-34718da88803",
      "type": "card",
      "attributes": {
        "created_at": "2019-08-16T09:49:04Z",
        "updated_at": "2019-08-16T09:49:04Z",
        "type": "physical",
        "last_four": "2345",
        "exp_month": 8,
        "exp_year": 2022,
        "status": "active",
        "account": "a8b9feb0-83b8-4fba-a447-e94404e6e0ad"
      }
    },
    {
      "id": "3137a8a4-9e98-479f-8f56-7197ceebff1b",
      "type": "card",
      "attributes": {
        "created_at": "2019-08-16T09:49:04Z",
        "updated_at": "2019-08-16T09:49:04Z",
        "type": "physical",
        "last_four": "2345",
        "exp_month": 8,
        "exp_year": 2022,
        "status": "active",
        "account": "c36cabac-cb31-46cb-bebf-961e8c9b0cb9"
      }
    }
  ],
  "links": {
    "prev": "http://example.org/v1/cards?page%5Bbefore%5D=070faceb-e978-40e5-a768-34718da88803",
    "next": null
  }
}
curl -g "https://cms-sandbox.bongloy.com/v1/cards" -X GET \
    -H "Authorization: Bearer 3yTB5FFE7LeBm13JL6quGaks3d89AtzvS9JpUShJUSE"

Retrieve a card

Request

Endpoint

GET /v1/cards/1fd8ebf3-11cb-4d71-9cba-8759df81123a

GET /v1/cards/:id

Parameters

Name Description
id required The id of the card to be retrieved.

Response


200 OK
{
  "data": {
    "id": "1fd8ebf3-11cb-4d71-9cba-8759df81123a",
    "type": "card",
    "attributes": {
      "created_at": "2019-08-16T09:49:04Z",
      "updated_at": "2019-08-16T09:49:04Z",
      "type": "physical",
      "last_four": "2345",
      "exp_month": 8,
      "exp_year": 2022,
      "status": "active",
      "account": "68ea7d0b-ee58-4b09-bafe-a962b7b520ad"
    }
  }
}
curl -g "https://cms-sandbox.bongloy.com/v1/cards/1fd8ebf3-11cb-4d71-9cba-8759df81123a" -X GET \
    -H "Authorization: Bearer ChsFarb5moz0KAvpmpP8Bv4pKLXf4y9IwTA-ECjWSJE"

Update a card

Request

Endpoint

PATCH /v1/cards/809b774f-4805-4e4f-81b1-0bade3b11767

PATCH /v1/cards/:id

Parameters

{
  "status": null,
  "data": {
    "id": "809b774f-4805-4e4f-81b1-0bade3b11767",
    "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": "809b774f-4805-4e4f-81b1-0bade3b11767",
    "type": "card",
    "attributes": {
      "created_at": "2019-08-16T09:49:04Z",
      "updated_at": "2019-08-16T09:49:04Z",
      "type": "physical",
      "last_four": "2345",
      "exp_month": 8,
      "exp_year": 2022,
      "status": "inactive",
      "account": "131694f9-d842-4ee4-8811-6c3bd0aed2fc"
    }
  }
}
curl "https://cms-sandbox.bongloy.com/v1/cards/809b774f-4805-4e4f-81b1-0bade3b11767" -d '{
  "status": null,
  "data": {
    "id": "809b774f-4805-4e4f-81b1-0bade3b11767",
    "type": "card",
    "attributes": {
      "status": "inactive"
    }
  }
}' -X PATCH \
    -H "Authorization: Bearer HTDjwYaeG_6ZIqXxux3_oYCexc7iGmOxtplhcHrWaLM"