Credit Cards are a form of payment issued by a financial company which enables the cardholder to use those funds within the linked account. That account may be the company/department expense account or it may be a personal account, where the company will reimburse the user at a later date.
Credit Cards can be managed within the Locomote Corporate Travel Platform in a secure and easy manner. Although different forms of payment exist in Locomote, some vendors (eg. airlines) require a credit card to be used as a guarantee to hold the booking until confirmation.
In Locomote, managing your Credit Card(s) is done within the user Profile via the Financial tab. An individual Credit Card cannot exist without being associated to a user, as it is profile data. (A company/department credit card is setup and used differently and cannot be retrieved via the API.)
Credit Cards can be uploaded & managed at a profile level by the Traveller, the assigned Travel Arranger(s) or the Company Administrator - if those roles have permission to manage individual financial information on behalf of the traveller. Depending on your company configuration, the Financial tab may not be available within user profiles - however they can still be accessed via the API.
Using the API, we can retrieve a list of credit cards setup for a specific user via the GET function. We can also create (POST) without requiring a specific credit card(s) id/code. Using the "find all" function (GET) we can identify specific credit card id(s) and either update (PATCH) or remove (DELETE). However if we mistakenly delete the record, we are unable to get it back as it will permanently & securely remove the record from the database.
Authorisation via "X-USER-USERNAME" and "X-USER-TOKEN"
All Credit Cards
Get Credit Cards
Returns all "credit_cards" resources belonging to a "users" resource.
GET https://locomotetmp.com/api/users/{work_employee_id}/credit_cards
Need to Know
This can only be done where a specific Employee ID is used within the URL. Using any command (GET, POST, PATCH, DELETE) for Credit Cards is an added function to the Users endpoint.Request Parameters
Parameter Name | Description | Required | Valid Values |
---|---|---|---|
page[number] | The page number to fetch | No | Any Integer |
page[size] | The number of items that appear on each page | No | Any Integer |
Example Request
curl -i -H X-USER_TOKEN\:\ [your API key] -H X-USER-USERNAME\:\ [Company Admin email] -H Content-Type\:\ application/json -XGET https\://[your subdomain].locomotetmp.com/api/users/{work_employee_id}/credit_cards
No request fields required for GET
Example Response
Status Code: 200 - OK
{
"data": [
{
"id": "f4710f34-cbb2-45df-ae45-e94064ddda75",
"type": "credit_cards",
"attributes": {
"number": "************4242",
"name": "John Smith",
"issuer": "VI",
"expiry": "09/2020",
"ownership_type": "personal"
},
"relationships": {
"user": {
"data": {
"id": "098765",
"type": "users"
}
}
}
},
{
"id": "69d6ec0a-31e4-417d-9481-5affd863df17",
"type": "credit_cards",
"attributes": {
"number": "************4444",
"name": "John Smith",
"issuer": "CA",
"expiry": "10/2022",
"ownership_type": "company"
},
"relationships": {
"user": {
"data": {
"id": "098765",
"type": "users"
}
}
}
}
],
Response Fields
Field Name | Description | Valid Values |
---|---|---|
id |
Identifier used to reference a given record | Read only |
type |
Type of resource | credit_cards |
number |
Number as displayed on the credit card | Character length: <= 16 Valid characters: 0-9 |
name |
Name as displayed on the credit card (credit card owner) |
Character length: <=50 |
issuer |
Card network provider code |
VI, AX, CA, DC, TP, DS, JP, CU Character length: <=2 |
expiry |
Date of credit card expiration | MM-YYYY |
ownership_type |
The reason of credit card ownership |
Personal, Company, Hotel Guarantee |
id |
Identifier used to reference the user's unique work_employee_id |
Character length: <=50 |
type |
Type of resource (the relationship is linked to) |
users |
Create Credit Cards
Create a new credit_cards resource
POST https://locomotetmp.com/api/users/{work_employee_id}/credit_cards
Request Parameters
Parameter Name | Description | Required | Valid Values |
---|---|---|---|
page[number] | The page number to fetch | No | Any Integer |
page[size] | The number of items that appear on each page | No | Any Integer |
Example Request
curl -i -H X-USER_TOKEN\:\ [your API key] -H X-USER-USERNAME\:\ [Company Admin email] -H Content-Type\:\ application/json -XPOST https\://[your subdomain].locomotetmp.com/api/users/{work_employee_id}/credit_cards
{
"data": {
"type": "credit_cards",
"attributes": {
"number": "378282246310005",
"name": "John Smith",
"issuer": "AX",
"expiry": "03/2024",
"ownership_type": "personal"
},
"relationships": {
"user": {
"data": { "id": "098765", "type": "users" }
}
}
}
}
Example Response
Status code 201 - Created
{
"data": {
"id": "33eb76ae-efb4-4d44-ba2f-0295bc6c0b5d",
"type": "credit_cards",
"attributes": {
"number": "***********0005",
"name": "John Smith",
"issuer": "AX",
"expiry": "03/2024",
"ownership_type": "personal"
},
"relationships": {
"user": {
"data": {
"id": "098765",
"type": "users"
}
}
}
},
Response Fields
Field Name | Description | Valid Values |
---|---|---|
id |
Identifier used to reference a given record | Read only |
type* |
Type of resource | credit_cards |
number* |
Number as displayed on the credit card | Character length: <= 16 Valid characters: 0-9 |
name* |
Name as displayed on the credit card (credit card owner) |
Character length: <=50 |
issuer* |
Card network provider code |
VI, AX, CA, DC, TP, DS, JP, CU Character length: <=2 |
expiry* |
Date of credit card expiration | MM-YYYY |
ownership_type* |
The reason of credit card ownership |
Personal, Company, Hotel Guarantee |
id* |
Identifier used to reference the user's unique work_employee_id |
Character length: <=50 |
type* |
Type of resource (the relationship is linked to) |
users |
Remember
You don't need the resource id as the system will assign code as the unique identifier record.
Single Credit Cards
Get a Credit Card
Get a single "credit_cards" resource
GET https://locomotetmp.com/api/users/{work_employee_id}/credit_cards{id}
Request Parameters
Parameter Name | Description | Required | Valid Values |
---|---|---|---|
page[number] | The page number to fetch | No | Any Integer |
page[size] | The number of items that appear on each page | No | Any Integer |
Example Request
curl -i -H X-USER_TOKEN\:\ [your API key] -H X-USER-USERNAME\:\ [Company Admin email] -H Content-Type\:\ application/json -XGET https\://[your subdomain].locomotetmp.com/api/users/{work_employee_id}/credit_cards{id}
No request fields required for GET
Example Response
Status Code: 200 - OK
{
"data": {
"id": "f4710f34-cbb2-45df-ae45-e94064ddda75",
"type": "credit_cards",
"attributes": {
"number": "************4242",
"name": "John Smith",
"issuer": "VI",
"expiry": "09/2020",
"ownership_type": "personal"
},
"relationships": {
"user": {
"data": {
"id": "098765",
"type": "users"
}
}
}
},
Response Fields
Field Name | Description | Valid Values |
---|---|---|
id |
Identifier used to reference a given record | Read only |
type |
Type of resource | credit_cards |
number |
Number as displayed on the credit card | Character length: <= 16 Valid characters: 0-9 |
name |
Name as displayed on the credit card (credit card owner) |
Character length: <=50 |
issuer |
Card network provider code |
VI, AX, CA, DC, TP, DS, JP, CU Character length: <=2 |
expiry |
Date of credit card expiration | MM-YYYY |
ownership_type |
The reason of credit card ownership |
Personal, Company, Hotel Guarantee |
id |
Identifier used to reference the user's unique work_employee_id |
Character length: <=50 |
type |
Type of resource (the relationship is linked to) |
users |
Update a Credit Cards
Update a "credit_cards" resource
PATCH https://locomotetmp.com/api/users/{work_employee_id}/credit_cards{id}
Request Parameters
Parameter Name | Description | Required | Valid Values |
---|---|---|---|
page[number] | The page number to fetch | No | Any Integer |
page[size] | The number of items that appear on each page | No | Any Integer |
Example Request
curl -i -H X-USER_TOKEN\:\ [your API key] -H X-USER-USERNAME\:\ [Company Admin email] -H Content-Type\:\ application/json -XPATCH https\://[your subdomain].locomotetmp.com/api/users/{work_employee_id}/credit_cards{id}
{
"data": {
"id": "f4710f34-cbb2-45df-ae45-e94064ddda75",
"type": "credit_cards",
"attributes": {
"number": "************4242",
"expiry": "01/2024",
"ownership_type": "personal"
}
}
}
Example Response
Status Code: 200 - OK
{
"data": {
"id": "f4710f34-cbb2-45df-ae45-e94064ddda75",
"type": "credit_cards",
"attributes": {
"number": "************4242",
"name": "John Smith",
"issuer": "VI",
"expiry": "01/2024",
"ownership_type": "personal"
},
"relationships": {
"user": {
"data": {
"id": "098765",
"type": "users"
}
}
}
},
Response Fields
Field Name | Description | Valid Values |
---|---|---|
id* |
Identifier used to reference a given record | Read only |
type* |
Type of resource | credit_cards |
number* |
Number as displayed on the credit card | Character length: <= 16 Valid characters: 0-9 |
name |
Name as displayed on the credit card (credit card owner) |
Character length: <=50 |
issuer |
Card network provider code |
VI, AX, CA, DC, TP, DS, JP, CU Character length: <=2 |
expiry* |
Date of credit card expiration | MM-YYYY |
ownership_type* |
The reason of credit card ownership |
Personal, Company, Hotel Guarantee |
id |
Identifier used to reference the user's unique work_employee_id |
Character length: <=50 |
type |
Type of resource (the relationship is linked to) |
users |
Delete a Credit Card
Delete a "credit_cards" resource
DELETE https://locomotetmp.com/api/users/{work_employee_id}/credit_cards{id}
Request Parameters
Parameter Name | Description | Required | Valid Values |
---|---|---|---|
page[number] | The page number to fetch | No | Any Integer |
page[size] | The number of items that appear on each page | No | Any Integer |
Example Request
curl -i -H X-USER_TOKEN\:\ [your API key] -H X-USER-USERNAME\:\ [Company Admin email] -H Content-Type\:\ application/json -XDELETE https\://[your subdomain].locomotetmp.com/api/users/{work_employee_id}/credit_cards{id}
No request fields required for DELETE
Example Response
Status Code: 204 - No content
No body returned for response
Response Fields
No response fields required as no content is returned after deletion.
Remember
You don't need any response fields entered (eg. type, code, name) to delete a record. The unique resource id (or {code}) is already identified in the URL, so the API knows which specific record to delete.
Restore a Credit Card
Unfortunately you cannot restore a credit card. Unlike a resource or user where the record is archived, once it has been deleted, it is removed from the database.
Need to Know
*
= Denotes mandatory field.
Troubleshooting
If you got a response code other than the code listed in the article, please refer to this page.
Comments
Article is closed for comments.