Simulate card management
What you will learn
✅ How to simulate these card management actions:
- Clearing
- Reversal
- Incremental transaction
- Single message clearing
- Single message reversal
If you are new to card issuing we recommend you read the Cards concept pages before starting this tutorial.
The tutorial assumes you have a knowledge of APIs and how they work. For more information on sending API calls, see API basics.
The tutorial uses these API endpoints:
API | Description |
|---|---|
Simulates merchant authorization | |
Simulates replacement of a memo post with a core transaction | |
Simulates reversal of an authorization | |
Simulates an incremental transaction reflected in the deposit account activity | |
Simulations the message type for cardholder verification to authorize and clear a transaction | |
Simulates a single message clearing transaction for which you can create a reversal transaction |
Before you begin
Make sure you have:
- Client ID
Register relevant webhook events
To receive the webhook events for this tutorial both partner accounts need to register each specific webhook event type. Once you are registered, the event objects are sent to the registered URLs.
The event object contains a list of resource identifiers used to download details on each event.
Simulate card management
The simulate endpoints within Card Management allow you to simulate most of the transaction scenarios you would experience in a live environment.
To simulate authorization
Call POST /v1/simulate/authorization. This endpoint simulates a merchant authorization that affects the available balance on the deposit account.
curl --location 'https://sandbox.crbcos.com/cardmanagement/v1/simulate/authorization' \
--data '{
"amount": 1999,
"cardId": "8c6a53e0-83ad-4b76-b446-b300006a3e6a",
"merchantCountryCode": "US",
"merchantName": "StreamFlix",
"merchantStreet": "123 Any St",
"merchantCity": "Anywhere",
"merchantState": "NY",
"merchantPostalCode": "10001",
"cardNetwork": "Visa",
"additionalAmounts": [],
"processingCode": "BillPayment"
}'The response includes the retrievalReferenceNumber and the cardId. You need these values to replace the memo post with a core transaction to post the activity record to the account, using the endpoint POST /v1/simulate/clearing as explained below.
{
"retrievalReferenceNumber": "644371423186",
"cardId": "8c6a53e0-83ad-4b76-b446-b300006a3e6a"
}To simulate clearing
In a real transaction, when the authorization request is made, a memo post reflects the account and impacts the available balance. However, the memo post remains until the clearing endpoint is called. Calling the POST /v1/simulate/clearing endpoint replaces the memo post with a core transaction to post the activity record to the account. In this simulation, authorization is not complete and the transaction does not post on the account until the simulate/clearing endpoint is called using the retrievalReferenceNumber and cardId.
curl --location 'https://sandbox.crbcos.com/cardmanagement/v1/simulate/clearing' \
--data '{
"cardId": "8c6a53e0-83ad-4b76-b446-b300006a3e6a",
"retrievalReferenceNumber": "644371423186",
"processingCode": "BillPayment"
}'To simulate reversal
This endpoint is used to reverse an existing authorization using the retrievalReferenceNumber returned in the response to the POST /v1/simulate/reversal endpoint. This reverses the original authorization placed on the account and removes it from the deposit account activity. The amount in this request can be any value and does not have to be the same amount as the original clearing transaction, which allows for a partial amount reversal.
curl --location 'https://sandbox.crbcos.com/cardmanagement/v1/simulate/reversal' \
--data '{
"cardId": "8c6a53e0-83ad-4b76-b446-b300006a3e6a",
"retrievalReferenceNumber": "654492282074",
"amount": "123"
}'To simulate a incremental transaction
This endpoint, used with the retrievalReferenceNumber returned by the POST /v1/simulate/incremental endpoint, creates an incremental transaction reflected in the deposit account activity. An example of an incremental transaction is when a hotel adds an additional charge for an item charged to your room.
curl --location 'https://sandbox.crbcos.com/cardmanagement/v1/simulate/incremental' \
--data '{
"cardId": "8c6a53e0-83ad-4b76-b446-b300006a3e6a",
"retrievalReferenceNumber": "654492282074",
"amount": "123"
}'To simulate single message clearing
A single message is a message type that uses real-time verification and requires the cardholder to enter their PIN to authorize and clear their transaction. An example of a transaction that uses the POST /v1/simulate/single-message-clearing enpoint is an ATM withdrawal.
curl --location 'https://sandbox.crbcos.com/cardmanagement/v1/simulate/single-message-clearing' \
--data '{
"processingCode": "Purchase",
"cardId": "8c6a53e0-83ad-4b76-b446-b300006a3e6a",
"amount": "22",
"merchantCountryCode": "US",
"merchantName": "StreamFlix",
"merchantStreet": "123 Any St",
"merchantCity": "Anywhere",
"merchantState": "NY",
"merchantPostalCode": "10001",
"cardNetwork": "Visa",
"additionalAmounts": [
{
"amountType": "Unknown",
"accountType": "NotSpecified",
"amount": "10"
}
]
}
'To simulate single message reversal
This endpoint allows you to create a reversal transaction to a single message clearing transaction. For example, use the POST /v1/simulate/single-message-reversal endpoint to simulate a purchase and then simulate a return with the single-message-reversal.
curl --location 'https://sandbox.crbcos.com/cardmanagement/v1/simulate/single-message-reversal' \
--data '{
"amount": "22",
"processingCode": "Purchase",
"cardId": "8c6a53e0-83ad-4b76-b446-b300006a3e6a",
"merchantCountryCode": "US",
"merchantName": "StreamFlix",
"merchantStreet": "123 Any St",
"merchantCity": "Anywhere",
"merchantState": "NY",
"merchantPostalCode": "10001",
"cardNetwork": "Visa",
"additionalAmounts": [
{
"amountType": "Unknown",
"accountType": "NotSpecified",
"amount": "10"
}
]
}
'