Gift card simulator
The Gr4vy gift card simulator is a sandbox-only connector that can be used to simulate
responses for balance checks and gift card redemptions and refunds. The values for the
error_code
, balance
and expiration_date
can be simulated by passing in different
pin and gift card numbers. This can be used when testing your integration.
Credentials
To configure the connection, you will need to set the following credentials.
Credential | Description |
---|---|
API Key | This is not validated and can be set to any string |
Error Codes
The pin
field is used to simulate error codes:
- Starts with
0
: Reserved for successful responses. Example:01000
. - Starts with
1
: Validation error returned by the provider,error_code
populated as explained below. Example10001
. - Starts with
2
: Server error,error_code
populated as explained below. Example:20010
. - Starts with
3
: Client error,error_code
populated as explained below. Example:30003
.
The rest of digits of the pin
number will be used to determine the error_code
:
error_code | Description | PIN last digits |
---|---|---|
invalid_gift_card | Gift card details are invalid, e.g. number or pin. | X0 |
expired_card | Gift card expired. | X1 |
inactive_card | Gift card is inactive. | X2 |
invalid_service_credentials | Service credentials are not valid. | X3 |
invalid_amount | Amount is invalid. | X4 |
incorrect_currency | Currency was rejected by service. | X5 |
insufficient_funds | Amount exceeds available balance. | X6 |
invalid_service_configuration | Service is incorrectly configured. | X7 |
operation_canceled | Operation was canceled as part of the batch. | X8 |
service_error | Internal server error or upstream processing error. | X9 |
service_network_error | Service was unreachable or experienced a timeout. | 10 |
unknown_error | Mapping to a more specific error code failed. | 11 |
Any other value will be mapped to unknown_error
too.
Balance
For endpoints returning the gift card balance, its value will be the pin
number as an integer.
The recommendation is that it starts with 0
, so it’ll always be considered a successful response.
For example, a PIN of 01234
will result in a gift card balance of 12.34
.
Expiration date
For endpoints returning the expiration date, the gift card number
will be considered.
- A gift card number that starts with
0
will result in an expiration date in the past. For example:0000444455556666
will result an expiration date set in the past. Currently, this will be set to a month in the past, but this behavior may change. - A gift card number that starts with
1
will result in an expiration date in future past. For example:1000444455556666
will result an expiration date set in the future. Currently, this will be set to a month in the future, but this behavior may change. - Otherwise, any other gift card will have no expiration date. For example:
9000444455556666
will result in a gift card without an expiration date.