Skip to Content
ResourcesSandbox EnvironmentTest Scenarios

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 AmountScenario DescriptionTransaction StatusChannel Response CodeError Message
9823Card declinedF (Failed)005Do not honor
9734Insufficient fundsF (Failed)051Insufficient funds
9651Card expiredF (Failed)054Expired card
9542Invalid card numberF (Failed)014Invalid account number
9467Card restrictedF (Failed)062Restricted card
9318Exceeds limitF (Failed)061Exceeds approval amount limit
9276CVV verification failedF (Failed)0N7Decline for CVV2 failure
9185Card reported lostF (Failed)041Lost card
9094Card stolenF (Failed)043Stolen card
8917Issuer declinedF (Failed)001Refer to card issuer
8826Suspected fraudF (Failed)059Suspected fraud
8743PIN incorrectF (Failed)055PIN incorrect
8659Transaction not permittedF (Failed)057Transaction not permitted
8571Card not activatedF (Failed)078Card not activated

Timeout Scenarios

Test AmountScenario DescriptionTransaction StatusChannel Response CodeDescription
7629Transaction timeoutF (Failed)091Issuer system no response
7518System failureF (Failed)096Issuer system error

Special Scenarios

Test AmountScenario DescriptionTransaction StatusChannel Response CodeDescription
6342Partial authorizationF (Failed)010Partial 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.23 US dollars
  • EUR: 97.34 euros
  • JPY: 9823 yen (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.

Last updated on