Build a Sample App
This tutorial will help you get familiar with the Galileo API. You will learn to create a simple account, activate it, simulate a transaction, send funds to another account, and freeze the account.
Before you start, see the Quickstart to get connected to the API. You can follow this tutorial using your own backend code or the Postman API client (see Postman Setup for a brief introduction to the tool).
Step 1 — Create an account and deposit funds
In this step, you will create an account and deposit funds using these endpoints:
For code samples of each endpoint request, see the API reference documentation.
Note
The Create Account endpoint can deposit funds during account creation, but it's often useful to deposit funds separately. In this tutorial, you will use the Create Payment endpoint to deposit funds after you create an account.
Create an account
- To create an account, send a POST request to the Create Account endpoint. For all API requests in this tutorial, you'll need these credentials:
apiLogin
apiTransKey
providerId
- Check the output. There should be a new
pmt_ref_no
in the response data.
In JSON format, the output should look like this:
{
"status_code": 0,
"status": "Success",
"system_timestamp": "2020-12-08 09:03:31",
"response_data": [
{
"pmt_ref_no": "1111",
"product_id": "5094",
"galileo_account_number": "0000",
"cip": null,
"card_id": "2726",
"card_number": "512773XXXXXX1828",
"expiry_date": null,
"card_security_code": null
}
],
"processing_time": 4.772,
"echo": {
"transaction_id": "c6285802-72e4-4760-9011-b39993ecfbd5",
"provider_transaction_id": "",
"provider_timestamp": null
}
}
In the next step, you'll use the new account number to deposit funds into the account.
Deposit funds
- To deposit funds into the account, call the Create Payment endpoint using the values in this table:
Parameter | Value |
---|---|
accountNo | The pmt_ref_no from your createAccount call |
amount | 50 |
type | RL (indicates a Retail Load payment) |
Note
When you deposit funds to an account in Sandbox and CV, the funds are not taken from a real account, but are simulated in the environment.
- Check the output. The
new_balance
should be50
:
{
"status_code": 0,
"status": "Success",
"system_timestamp": "2020-12-08 09:25:31",
"response_data": {
"old_balance": 0,
"new_balance": 50,
"fee_amount": "0",
"payment_trans_id": 2543,
"transaction_id": "08009594-5b37-4e84-9b42-4dd7450010f6"
},
"processing_time": 4.492,
"echo": {
"transaction_id": "08009594-5b37-4e84-9b42-4dd7450010f6",
"provider_transaction_id": "",
"provider_timestamp": null
}
Keep your code accessible. You will use both of these endpoints in later steps.
Step 2 — Activate the card and account
In this step, you will activate the account and card so that they can be used in transactions. Card and account statuses are independent, so you will need to activate both before you can use the card. You'll activate both with these endpoints:
Activate the account
- To activate the account, call the Modify Status with the following values:
Parameter | Value |
---|---|
accountNo | The pmt_ref_no from your createAccount call |
type | 11 (moves the account to status: N ). For more information on types and statuses, see the Modify Status Types enumeration. |
Note
Using Modify Status type 11 to activate an account is appropriate in the sandbox, but it should not be used in CV or Production. In those cases, your accounts will be moved to Active status either when the card is activated or when an automated process activates the account.
- Check the output. The
account_status
should beN
, indicating that the account is active:
{
"status_code": 0,
"status": "Success",
"system_timestamp": "2020-12-08 10:24:13",
"response_data": {
"pmt_ref_no": "1111",
"account_status": "N"
},
"processing_time": 4.358,
"echo": {
"transaction_id": "5ffa9361-fbfa-4068-8489-d14811b44e88",
"provider_transaction_id": "",
"provider_timestamp": null
}
}
- The account is now active but the card is not. To see the card status, call the Get Card endpoint with the following value:
Parameter | Value |
---|---|
accountNo | The pmt_ref_no from your createAccount call |
- Check the output. The
status
should now beW
(see Card Statuses for more information):
{
"status_code": 0,
"status": "Success",
"system_timestamp": "2020-12-09 14:34:01",
"response_data": {
"card_number": "512773XXXXXX6554",
"expiry_date": null,
"card_security_code": null,
"status": "W",
"card_id": "2728",
"external_card_id": null,
"pmt_ref_no": "1111",
"first_name": "",
"middle_name": "",
"last_name": "",
"encrypted_card_number": null,
"encrypted_expiry_date": null,
"embossed_cards": [],
"freeze_info": {
"status": "Unfrozen",
"start_date": null,
"end_date": null
},
"pin_fail_count": "0",
"pin_fail_date": null,
"spend_controls": {
"available_credit": null,
"single_use": null,
"credit_limit": null
}
},
"processing_time": 0.285,
"echo": {
"transaction_id": "a551f1ba-aa71-4672-8eed-73b25a2ac484",
"provider_transaction_id": "",
"provider_timestamp": null
}
}
Activate the card
- To activate the card, call the Modify Status endpoint again, but change the
type
to7
:
Parameter | Value |
---|---|
accountNo | The pmt_ref_no from your createAccount call |
type | 7 (moves the card to status: N ). For more information on types and statuses, see the Modify Status Types enumeration. |
Note
Using Modify Status type 7 to activate a card is appropriate in the sandbox, but it should not be used in CV or Production. Instead, choose an option in Card activation in the Setting Up a Card Program guide.
- Check the output again. The
account_status
should still beN
:
{
"status_code": 0,
"status": "Success",
"system_timestamp": "2020-12-08 10:36:15",
"response_data": {
"pmt_ref_no": "1111",
"account_status": "N"
},
"processing_time": 4.647,
"echo": {
"transaction_id": "41690d14-cf35-4f28-bfc8-924d50e0ae5a",
"provider_transaction_id": "",
"provider_timestamp": null
}
}
- Call the Get Card endpoint again with the same
accountNo
. - Check the output for the Get Card call. The
status
should now beN
, indicating the card is active:
{
"status_code": 0,
"status": "Success",
"system_timestamp": "2020-12-09 14:45:56",
"response_data": {
"card_number": "512773XXXXXX6554",
"expiry_date": null,
"card_security_code": null,
"status": "N",
"card_id": "2728",
"external_card_id": null,
"pmt_ref_no": "0000",
"first_name": "",
"middle_name": "",
"last_name": "",
"encrypted_card_number": null,
"encrypted_expiry_date": null,
"embossed_cards": [],
"freeze_info": {
"status": "Unfrozen",
"start_date": null,
"end_date": null
},
"pin_fail_count": "0",
"pin_fail_date": null,
"spend_controls": {
"available_credit": null,
"single_use": null,
"credit_limit": null
}
},
"processing_time": 0.296,
"echo": {
"transaction_id": "54c53a34-d1d3-43cd-9e9e-d824f97fc80d",
"provider_transaction_id": "",
"provider_timestamp": null
}
}
Step 3 — Simulate a card transaction
After the account and card are active, you can simulate a card transaction. In a test environment, it is not possible to use a real transaction with a card network. Instead, you'll simulate authorization, simulate settlement, and then check the final balance with these endpoints:
Simulate authorization
- To simulate the authorization of a $20 transaction, call the Simulate Card Authorization endpoint with the following values:
Parameter | Value |
---|---|
accountNo | The pmt_ref_no from your createAccount call |
amount | 20 |
association | visa |
merchantName | A business name (for example, The Toastery ). |
- Check the output. The
auth_response_code
should be00
:
{
"status_code": 0,
"status": "Success",
"system_timestamp": "2020-12-07 15:51:57",
"response_data": {
"auth_response_code": "00",
"auth_response_description": "Success",
"auth_id": 1437
},
"processing_time": 0.756,
"echo": {
"transaction_id": "4a228320-c991-4a8f-b95a-eb6c82f8961b",
"provider_transaction_id": "",
"provider_timestamp": null
}
}
Note
If the
auth_response_code
is05
, it is likely that either the card or account was not properly activated (see Authorization Response Codes for more information). Make sure to passtype: 7
andtype: 11
through the Modify Status endpoint.
Simulate settlement
Now that you have authorized a transaction, the next step is to settle it.
- Call the Simulate Card Settlement endpoint with the following values:
Parameter | Value |
---|---|
accountNo | The pmt_ref_no from your createAccount call |
association | visa |
authId | The authId from your createSimulatedCardAuth call |
- Check the output. The
settle_response_code
should be00
:
{
"status_code": 0,
"status": "Success",
"system_timestamp": "2020-12-08 10:55:49",
"response_data": {
"settle_response_code": "00",
"settle_response_description": "Success",
"settle_dtl_id": 512
},
"processing_time": 1.826,
"echo": {
"transaction_id": "2af57d44-8787-43bd-b314-99b35832a354",
"provider_transaction_id": "",
"provider_timestamp": null
}
}
Get the balance
Check the balance to make sure the transaction went through as expected.
- Call the Get Balance endpoint with the following value:
Parameter | Value |
---|---|
accountNo | The pmt_ref_no from your createAccount call |
- Check the output. The
balance
should be30
:
{
"status_code": 0,
"status": "Success",
"processing_time": 0.088,
"response_data": {
"balance": 30,
"balance_without_pending": "30",
"currency_code": "840",
"pending_adjustments": 0,
"pending_billpay": 0,
"pending_purchase": 0,
"balance_without_auths": 30
},
"echo": {
"provider_transaction_id": "",
"provider_timestamp": null,
"transaction_id": "CUXXD4AEUMWOBMPKYBZ8"
},
"rtoken": "8cc16de0-5eda-4e2a-968e-3b08fce6f778",
"system_timestamp": "2020-07-13 10:31:56"
}
Step 4 — Send funds between accounts
In this step, you’ll set up a second account, activate it, and send funds from the first account. Be sure to keep your account number handy. You will use these endpoints:
Create a second new account
- To create a second account, call the Create Account.
- Check the output. The status should indicate
Success
:
{
"status_code": 0,
"status": "Success",
"system_timestamp": "2020-12-08 11:24:08",
"response_data": [
{
"pmt_ref_no": "7777",
"product_id": "5094",
"galileo_account_number": "0000",
"cip": null,
"card_id": "2727",
"card_number": "512773XXXXXX7167",
"expiry_date": null,
"card_security_code": null
}
],
"processing_time": 4.882,
"echo": {
"transaction_id": "40478edd-5047-477d-b100-83f339a090c5",
"provider_transaction_id": "",
"provider_timestamp": null
}
}
Activate the receiving account and card
Activate the second account and card in the same way you activated the first account.
- To activate the account, call the Modify Status endpoint with the following values:
Parameter | Value |
---|---|
accountNo | The pmt_ref_no from the second account you created |
type | 11 (moves the account to status: N ) |
- Check the output. The
account_status
should beN
, indicating that the account is active (see Account Statuses for more information):
{
"status_code": 0,
"status": "Success",
"system_timestamp": "2020-12-08 11:27:03",
"response_data": {
"pmt_ref_no": "7777",
"account_status": "N"
},
"processing_time": 4.524,
"echo": {
"transaction_id": "78dc07c5-a353-48dc-a8a7-3c84e5df1873",
"provider_transaction_id": "",
"provider_timestamp": null
}
}
- Next, activate the card. Call the Modify Status endpoint with the following values:
Parameter | Value |
---|---|
accountNo | The pmt_ref_no from the second account you created |
type | 7 (moves the card to status: N ) |
- Check the output again. The
account_status
should beN
:
{
"status_code": 0,
"status": "Success",
"system_timestamp": "2020-12-08 11:27:03",
"response_data": {
"pmt_ref_no": "7777",
"account_status": "N"
},
"processing_time": 4.524,
"echo": {
"transaction_id": "78dc07c5-a353-48dc-a8a7-3c84e5df1873",
"provider_transaction_id": "",
"provider_timestamp": null
}
}
Transfer funds
- To transfer funds from the first account to the second, call the Create Account Transfer endpoint with the following values:
Parameter | Value |
---|---|
accountNo | The pmt_ref_no from the first account you created |
amount | 10 |
transferToAccountNo | The pmt_ref_no from the second account you created |
- Check the output
response_data
:
- The top-level
new_balance
should be20
(this is the balance for your first account). - Under
transfer_to_account
, thenew_balance
should be10
(this is the balance for your second account):
{
"status_code": 0,
"status": "Success",
"system_timestamp": "2020-12-08 11:33:53",
"response_data": {
"old_balance": 30,
"new_balance": 20,
"adjustment_trans_id": 2042,
"transfer_account_id": "1150",
"sender_fee_amount": 0,
"payment_trans_id": 2549,
"transfer_to_account": {
"old_balance": 0,
"new_balance": 10
}
},
"processing_time": 4.809,
"echo": {
"transaction_id": "753d02ed-fe4c-4d29-aa5e-89641f78692e",
"provider_transaction_id": "",
"provider_timestamp": null
}
}
- You can verify the balance by sending each PRN to the Get Balance endpoint. You might also try sending each PRN to Get Transaction History to see how one account was credited and the other debited.
Step 5 — Freeze an account
In this step, you'll freeze an account, verify that it's frozen, then unfreeze it. You will use these endpoints that you've already had practice with:
Freeze the account
- To freeze the account, call the Modify Status endpoint with the following values:
Parameter | Value |
---|---|
accountNo | The pmt_ref_no from the second account you created |
type | 17 (freezes the account) |
- Check the output. The status should indicate
Success
:
{
"status_code": 0,
"status": "Success",
"system_timestamp": "2020-12-08 11:48:10",
"response_data": {
"pmt_ref_no": "1111",
"account_status": "N"
},
"processing_time": 4.391,
"echo": {
"transaction_id": "564f70db-759e-4601-a9f0-c2e95cd26e54",
"provider_transaction_id": "",
"provider_timestamp": null
}
}
Note
When you freeze an account, the freeze is reflected in the
freeze_info
object in the Get Card and Get Account Cards endpoints, and not thestatus
. See Freezing cards in the About Cards guide for more information.
Test the frozen account
Try authorizing a transaction to see what happens to a frozen account.
- Call the Simulate Card Authorization endpoint with the following values:
Parameter | Value |
---|---|
accountNo | The pmt_ref_no from the first account you created |
amount | 10 |
association | visa |
merchantName | A business name (for example,The Toastery ). |
- Check the output. The
auth_response_code
should be57
, indicating that the transaction is not permitted (see Authorization Response Codes for more information):
{
"status_code": 0,
"status": "Success",
"system_timestamp": "2020-12-08 11:52:01",
"response_data": {
"auth_response_code": "57",
"auth_response_description": "Transaction not permitted",
"auth_id": 1445
},
"processing_time": 0.505,
"echo": {
"transaction_id": "6d2c2ea9-bd8f-4b12-8d8d-ced6a3ba68fb",
"provider_transaction_id": "",
"provider_timestamp": null
}
}
Unfreeze the account
- To remove the freeze from the account, call the Modify Status endpoint again, but change
type
to18
:
Parameter | Value |
---|---|
accountNo | The pmt_ref_no from the frozen account |
type | 18 (unfreezes the account) |
- Check the output. The status should indicate
Success
:
{
"status_code": 0,
"status": "Success",
"system_timestamp": "2020-12-08 11:55:19",
"response_data": {
"pmt_ref_no": "1111",
"account_status": "N"
},
"processing_time": 4.42,
"echo": {
"transaction_id": "292c9caf-6482-43d4-895e-f0f81587bb53",
"provider_transaction_id": "",
"provider_timestamp": null
}
}
Test the unfrozen account
- Call the Simulate Card Authorization endpoint with same following values:
Parameter | Value |
---|---|
accountNo | The pmt_ref_no from the first account you created |
amount | 10 |
association | visa |
merchantName | A business name (for example,The Toastery ). |
- Check the output. The
auth_response_code
should now be00
, indicating that the transaction is authorized:
{
"status_code": 0,
"status": "Success",
"system_timestamp": "2020-12-08 11:58:01",
"response_data": {
"auth_response_code": "00",
"auth_response_description": "Success",
"auth_id": 1446
},
"processing_time": 0.543,
"echo": {
"transaction_id": "ed6de582-897d-4968-8de9-d5ccf89a2188",
"provider_transaction_id": "",
"provider_timestamp": null
}
}
Updated 10 months ago