Manage Cards
Get Card Information
When an integrator orders a card, they are provided with a card_id
which helps identify a card in the system, but doesn't supply any more details about the card. An integrator can therefore make an API call to retrieve all the card_id
of all the cards they have created. This call returns a list of all the cards associated with an integrator.
Get all cards associated to a particular user
If an integrator has created multiple cards for a user, they can fetch all cards created for that user. This endpoint funtions to a limit of 15 cards at a time.
curl --request GET \
--url 'https://api-sandbox.spendjuice.com/cards?user_id=3d6c9e2e-1caf-4807-97ff-bbd35fc4dc1b&limit=15' \
--header 'Accept: application/json'
Getting the details of a card
In other to get full information, like the card number and CVV, about a particular card, an integrator would make an API call using the /cards/{id}
endpoint. The sample below shows the response you get when you request card details in a list that carries all the cards an integrator has created to date.
Required: the user_id
user_id
curl --location --request GET 'https://api-sandbox.spendjuice.com/cards?user_id=35dbb9c6-eb4c-4dc5-8c9d-2923b82200b1' \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJqdWljZSIsImV4cCI6MTY1MjI4MTk5MiwiaWF0IjoxNjM2NzI5OTkyLCJpc3MiOiJqdWljZSIsImp0aSI6IjhjY2VlYmNjLWM5ZWUtNDE4Ni05MjhkLWEyZjQyZjMzMjdmZiIsIm5iZiI6MTYzNjcyOTk5MSwic3ViIjoiY2FyZC1pbnRlZ3JhdG9yOjE4YjdjOWI2LWNmNGYtNDg2YS1hNDFlLTZiY2IyMDBlYjIyZiIsInR5cCI6ImFjY2VzcyJ9.FgYD7KTWMdFGjaf3rjQxre7iWIZ9_mnP2AJaCWGW3PBRVNilAzu_UzJAtpEYlYJx6p0l7tUpivX-xZ2wBswcgw'
[
{
"balance": 50000,
"card_number": "5368989121220882",
"card_type": "virtual",
"cvv2": null,
"expiry": "2022-11-13T00:00:00.000Z",
"id": "d5a929b7-ff37-432d-8dc0-5ecb1c47ad23",
"single_use": false,
"status": "active",
"valid": "11/22"
},
{
"balance": 100000,
"card_number": "5368989503830225",
"card_type": "virtual",
"cvv2": null,
"expiry": "2022-11-13T00:00:00.000Z",
"id": "25db13fe-e758-444e-949f-618f3f4aa7e4",
"single_use": false,
"status": "active",
"valid": "11/22"
},
{
"balance": 100,
"card_number": "5368989357331254",
"card_type": "virtual",
"cvv2": null,
"expiry": "2022-11-13T00:00:00.000Z",
"id": "a5a4fdd9-1889-40b0-b66d-7d2aea478116",
"single_use": false,
"status": "active",
"valid": "11/22"
}
]
Top-up a card balance
Topping up a card for a user is done by the integrator using the endpoint /cards/credit/balance
.
This API call requires:
• the amount
to top up the card with - this amount should be in USD cents,
• the card_id
gotten when the card was created,
• and the source
for funding. The source account is set to default to be the integrator account (float), but it could also be via deposit.
curl --request PATCH \
--url https://api-sandbox.spendjuice.com/cards/credit/balance \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '
{
"source": "business",
"card_id": "5368982642798882",
"amount": "20000"
}
'
Debit a Card to float
An integrator may want to revert a card's account balance to float. They can use the /cards/debit/balance endpoint for this function.
curl --request PATCH \
--url https://api-sandbox.spendjuice.com/cards/debit/balance \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '
{
"source": "business",
"amount": "20000",
"card_id": "5368982642798882"
}
'
Freeze a Card
The need may arise for an integrator to stop card activity for any of their users- the user may request it, or activity on the card seems suspicious. In this case, with a short API call, the integrator can freeze said card(s). Cards frozen can be reactivated anytime.
To freeze a card, the integrator would need to provide the card_id
of the particular card they want frozen. It's found in the response returned when the Order Virtual Card
api was called.
Use the /cards/{id}/freeze
endpoint to freeze a card, as shown.
curl --location --request PATCH 'https://api-sandbox.spendjuice.com/cards/d5a929b7-ff37-432d-8dc0-5ecb1c47ad23/freeze' \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJqdWljZSIsImV4cCI6MTY1MjI4MTk5MiwiaWF0IjoxNjM2NzI5OTkyLCJpc3MiOiJqdWljZSIsImp0aSI6IjhjY2VlYmNjLWM5ZWUtNDE4Ni05MjhkLWEyZjQyZjMzMjdmZiIsIm5iZiI6MTYzNjcyOTk5MSwic3ViIjoiY2FyZC1pbnRlZ3JhdG9yOjE4YjdjOWI2LWNmNGYtNDg2YS1hNDFlLTZiY2IyMDBlYjIyZiIsInR5cCI6ImFjY2VzcyJ9.FgYD7KTWMdFGjaf3rjQxre7iWIZ9_mnP2AJaCWGW3PBRVNilAzu_UzJAtpEYlYJx6p0l7tUpivX-xZ2wBswcgw'
{
"balance": 50000,
"card_number": "5368989121220882",
"card_type": "virtual",
"cvv2": "377",
"expiry": "2022-11-13T00:00:00.000Z",
"id": "d5a929b7-ff37-432d-8dc0-5ecb1c47ad23",
"single_use": false,
"status": "inactive",
"valid": "11/22"
}
Unfreeze a card
Use the /cards/{id}/unfreeze
endpoint to reactivate a card, after any issue is resolved, or based on user request. Just like in the freeze card API call, unfreezing a card would require the card_id
of the card an integrator would like to restore activity. Making this PATCH
request should return the response shown.
curl --location --request PATCH 'https://api-sandbox.spendjuice.com/cards/d5a929b7-ff37-432d-8dc0-5ecb1c47ad23/unfreeze' \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJqdWljZSIsImV4cCI6MTY1MjI4MTk5MiwiaWF0IjoxNjM2NzI5OTkyLCJpc3MiOiJqdWljZSIsImp0aSI6IjhjY2VlYmNjLWM5ZWUtNDE4Ni05MjhkLWEyZjQyZjMzMjdmZiIsIm5iZiI6MTYzNjcyOTk5MSwic3ViIjoiY2FyZC1pbnRlZ3JhdG9yOjE4YjdjOWI2LWNmNGYtNDg2YS1hNDFlLTZiY2IyMDBlYjIyZiIsInR5cCI6ImFjY2VzcyJ9.FgYD7KTWMdFGjaf3rjQxre7iWIZ9_mnP2AJaCWGW3PBRVNilAzu_UzJAtpEYlYJx6p0l7tUpivX-xZ2wBswcgw'
{
"balance": 50000,
"card_number": "5368989121220882",
"card_type": "virtual",
"cvv2": "377",
"expiry": "2022-11-13T00:00:00.000Z",
"id": "d5a929b7-ff37-432d-8dc0-5ecb1c47ad23",
"single_use": false,
"status": "active",
"valid": "11/22"
}
Updated over 2 years ago