Test Scenarios
SUNBAY sandbox environment simulates different payment channel transaction scenarios through test amounts. You only need to use specific amounts when initiating transactions, and the system will automatically return corresponding test results, without needing to use specific test card numbers.
How It Works
Sandbox environment simulates payment channel responses based on specific transaction amount values. For example:
- Amount is
9823→ Simulates payment channel returning card declined - Amount is
9734→ Simulates payment channel returning insufficient funds - Amount is
7629→ Simulates payment channel response timeout - Other amounts → Simulates payment channel returning transaction success
Except for special test amounts listed in the table below, using any other amount will simulate a normal successful transaction.
Note: Test amounts can only simulate payment channel level responses, cannot simulate SUNBAY platform level business logic errors (such as parameter validation failure, original transaction does not exist, etc.).
Test Amount Reference Table
Success Scenarios
Using any non-special test amount (amounts not in the table below) will simulate transaction success, returning S (Success) status and 000 channel response code.
Failure Scenarios
| Test Amount | Scenario Description | Transaction Status | Channel Response Code | Error Message |
|---|---|---|---|---|
9823 | Card declined | F (Failed) | 005 | Do not honor |
9734 | Insufficient funds | F (Failed) | 051 | Insufficient funds |
9651 | Card expired | F (Failed) | 054 | Expired card |
9542 | Invalid card number | F (Failed) | 014 | Invalid account number |
9467 | Card restricted | F (Failed) | 062 | Restricted card |
9318 | Exceeds limit | F (Failed) | 061 | Exceeds approval amount limit |
9276 | CVV verification failed | F (Failed) | 0N7 | Decline for CVV2 failure |
9185 | Card reported lost | F (Failed) | 041 | Lost card |
9094 | Card stolen | F (Failed) | 043 | Stolen card |
8917 | Issuer declined | F (Failed) | 001 | Refer to card issuer |
8826 | Suspected fraud | F (Failed) | 059 | Suspected fraud |
8743 | PIN incorrect | F (Failed) | 055 | PIN incorrect |
8659 | Transaction not permitted | F (Failed) | 057 | Transaction not permitted |
8571 | Card not activated | F (Failed) | 078 | Card not activated |
Timeout Scenarios
| Test Amount | Scenario Description | Transaction Status | Channel Response Code | Description |
|---|---|---|---|---|
7629 | Transaction timeout | F (Failed) | 091 | Issuer system no response |
7518 | System failure | F (Failed) | 096 | Issuer system error |
Special Scenarios
| Test Amount | Scenario Description | Transaction Status | Channel Response Code | Description |
|---|---|---|---|---|
6342 | Partial authorization | F (Failed) | 010 | Partial authorization is not supported yet; returns failure |
Amount Precision
Test amounts must match exactly. Amounts in the table are all integer amounts (minor currency units) passed to API interface:
- Test amount
9823, if transaction currency is USD, represents 98.23 US dollars (USD has 2 decimal places) - Test amount
9823, if transaction currency is JPY, represents 9823 yen (JPY has no decimals)
This design makes test amounts applicable to all currencies without considering decimal place differences.
Usage Examples
Test Normal Payment
// Java example
SaleRequest request = SaleRequest.builder()
.appId("your_test_app_id")
.merchantId("your_test_merchant_id")
.terminalSn("your_terminal_sn")
.transactionRequestId("TEST_SALE_001")
.amount(Amount.builder()
.priceAmount("4237") // Use any non-special amount to test success scenario ($42.37)
.priceCurrency("USD")
.build())
.build();
SaleResponse response = client.sale(request);
// Expected result: transactionStatus = "S", channelResponseCode = "000"Test Card Declined
// Node.js example
const request = {
appId: 'your_test_app_id',
merchantId: 'your_test_merchant_id',
terminalSn: 'your_terminal_sn',
transactionRequestId: 'TEST_SALE_002',
amount: {
priceAmount: '9823', // Use 9823 to test decline scenario ($98.23)
priceCurrency: 'USD'
}
};
const response = await client.sale(request);
// Expected result: transactionStatus = "F", channelResponseCode = "005"Testing Recommendations
1. Cover Main Scenarios
Recommend testing at least the following scenarios:
- ✅ Normal payment success (use any non-special amount, such as
4237, i.e. $42.37) - ✅ Card declined (
9823, i.e. $98.23) - ✅ Insufficient funds (
9734, i.e. $97.34) - ✅ Transaction timeout (
7629, i.e. $76.29)
2. Test Error Handling
Use failure scenarios to test your error handling logic:
try {
SaleResponse response = client.sale(request);
if ("S".equals(response.getTransactionStatus())) {
// Handle success
} else {
// Handle failure
log.error("Transaction failed: {}, {}",
response.getTransactionResultCode(),
response.getTransactionResultMsg());
}
} catch (Exception e) {
// Handle exception
log.error("API call failed", e);
}3. Test Retry Mechanism
Use timeout scenario (7629) to test your retry logic:
async function saleWithRetry(request, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
const response = await client.sale(request);
if (response.transactionStatus === 'F') {
// Timeout/failure scenarios both return F; check channelResponseCode 091 for timeout before retry
continue;
}
return response;
} catch (error) {
if (i === maxRetries - 1) throw error;
}
}
}Other Test Amounts
Besides the special test amounts above, you can use any other amount for testing, and the system will default to simulating successful transactions.
Default Behavior
If the amount used is not in the test amount reference table above, the system will:
- Default return success result (S (Success), channel response code
000) - Use actual transaction processing flow
- Suitable for testing normal business logic and real amount scenarios
FAQ
Do test amounts distinguish currencies?
No. Test amounts use integer values (such as 9823, 9734), applicable to all currencies. System will automatically handle decimal places based on currency:
- USD:
98.23US dollars - EUR:
97.34euros - JPY:
9823yen (no decimal places)
Can I use real card numbers for testing?
No. Sandbox environment does not support real card number transactions. All tests simulate scenarios through test amounts.
Are test amounts valid in production environment?
No. Test amounts are only valid in sandbox environment. Production environment will process all amounts according to real transaction flow.
How to test specific error codes?
Refer to the test amount reference table above, use corresponding amounts to trigger specific error codes. If you need to test error codes not in the table, please contact technical support.