Testing
Sudo provides an easy way to generate cards and simulate transactions in a sandbox environment. This allows you to test your integrations and ensure that everything works as expected before going live making real transactions.
You can simulate card transactions using your sandbox credentials as seen on your dashboard with these steps:
- Fund your default account.
- Create a funding source.
- Create a cardholder.
- Generate a sample card.
- Create/Map card to a cardholder.
- Simulate your first card transaction.
1. Fund your default account.
To fund your default account, get the list of all accounts and note the _id
, accountNumber
, and bankCode
of the default account. Then proceed to make a transfer to the account in LIVE or fund using the sandbox simulator.
curl --location --request GET 'https://api.sandbox.sudo.cards/accounts?page=0&limit=25' \
--header 'Authorization: Bearer ••••••••••••••••••••••••••••••••••••CREE1M0EwQjgyMjI0NUE3QUM=' \
Then proceed to make funding using the sandbox simulator.
curl --location --request POST 'https://api.sandbox.sudo.cards/accounts/simulator/fund' \
--header 'Authorization: Bearer ••••••••••••••••••••••••••••••••••••CREE1M0EwQjgyMjI0NUE3QUM=' \
--header 'Content-Type: application/json' \
--data-raw '{
"accountId": "{{defaultAccountId}}",
"amount": 5000.00
}'
2. Create a funding source.
To make Sudo accept all timed out authorization requests, set authorizeByDefault
to true
. We will re-attempt to send the completed authorization request to your webhook after approving such a request.
curl --location --request POST 'https://api.sandbox.sudo.cards/fundingsources' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ••••••••••••••••••••••••••••••••••••CREE1M0EwQjgyMjI0NUE3QUM=' \
--data-raw '{
"type": "gateway",
"status": "active",
"jitGateway": {
"url": "https://api.domain.tld/sudo/jitgateway",
"authorizationHeader": "Bearer MY_TOKEN",
"authorizeByDefault": false
}
}'
3. Create a cardholder.
A cardholder is either an individual or business entity that can be issued a payment card. To get started, create a cardholder with name, billingAddress and type.
You can include additional information like KYC details, phone number, and email address. See Customers under the API Reference.
curl --location --request POST 'https://api.sandbox.sudo.africa/customers' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ••••••••••••••••••••••••••••••••••••CREE1M0EwQjgyMjI0NUE3QUM=' \
--data-raw '{
"type": "individual",
"name": "John Doe",
"status": "active",
"individual": {
"firstName": "John",
"lastName": "Doe"
},
"billingAddress": {
"line1": "4 Barnawa Close",
"line2": "Off Challawa Crescent",
"city": "Barnawa",
"state": "Kaduna",
"country": "NG",
"postalCode": "800001"
}
}'
4. Generate a sample card.
For physical cards, a card is needed before mapping. To generate a card on the sandbox environment, send a request to the card generation endpoint.
curl --location --request GET 'https://api.sandbox.sudo.cards/cards/simulator/generate' \
--header 'Authorization: Bearer ••••••••••••••••••••••••••••••••••••CREE1M0EwQjgyMjI0NUE3QUM=' \
5. Create/Map card to a cardholder.
This request requires the cardholder ID from the previous step, type, card number (if a physical card), currency, and status.
curl --location --request POST 'https://vault.sandbox.sudo.cards/cards' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ••••••••••••••••••••••••••••••••••••CREE1M0EwQjgyMjI0NUE3QUM=' \
--data-raw '{
"customerId": "5f8b75ef12a06df84bd7aa3a",
"type": "physical",
"number": "5061000001743021565",
"currency": "NGN",
"status": "active"
}'
- Make your first card transaction.
To make your first card transaction, proceed to simulate a transaction using the simulation endpoint.
On Live
Proceed to make your first transaction at an ATM, POS, or Online using your card.
curl --location --request POST 'https://api.sudo.africa/cards/simulator/authorization' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ••••••••••••••••••••••••••••••••••••CREE1M0EwQjgyMjI0NUE3QUM=' \
--data-raw '{
"cardId": "5f90f250349360504cf82619",
"channel": "web",
"type": "purchase",
"amount": 3500,
"currency": "NGN",
"merchant": {
"category": "7399",
"merchantId": "000000001",
"name": "Acme Inc",
"city": "Barnawa",
"state": "KD",
"country": "NG"
}
}'
Updated almost 3 years ago