Skip to content

Test Mode ​

Use test mode to develop and test your integration without processing real payments.

Test vs Live ​

Test ModeLive Mode
API Key Prefixsk_test_...sk_live_...
Base URLapi.sandbox.fyber.oneapi.fyber.one
Real ChargesNoYes
Test CardsRequiredReal cards only

Test Cards ​

Use these card numbers in test mode:

Successful Payments ​

CardNumberDescription
Visa4242 4242 4242 4242Always succeeds
Mastercard5555 5555 5555 4444Always succeeds
Amex3782 822463 10005Always succeeds

Declined Payments ​

CardNumberDescription
Declined4000 0000 0000 0002Always declined
Insufficient Funds4000 0000 0000 9995Insufficient funds
Expired Card4000 0000 0000 0069Expired card error
Incorrect CVC4000 0000 0000 0127CVC check fails

3D Secure ​

CardNumberDescription
3DS Required4000 0027 6000 3184Requires 3D Secure
3DS Authenticated4000 0000 0000 32203DS succeeds
3DS Failed4000 0000 0000 30633DS fails

Special Cases ​

CardNumberDescription
Processing Error4000 0000 0000 0119Processing error
Rate Limited4000 0000 0000 6975Rate limit error

Card Details ​

For all test cards, use:

FieldValue
Expiry DateAny future date (e.g., 12/25)
CVCAny 3 digits (e.g., 123)
ZIP/PostalAny value

Example Usage ​

Hosted Checkout ​

Create a checkout session and use test cards on the hosted page:

javascript
const session = await fyber.checkout.sessions.create({
  mode: 'payment',
  amount: 5000,
  currency: 'JMD',
  successUrl: 'https://yoursite.com/success',
  cancelUrl: 'https://yoursite.com/cancel',
});

// Redirect to session.url
// Enter test card: 4242 4242 4242 4242

Testing Webhooks ​

Test webhook signatures with your test webhook secret:

javascript
// Use your test webhook secret (whsec_test_...)
const event = Fyber.webhooks.verify(
  payload,
  signature,
  'whsec_test_your_secret'
);

Local Development ​

Use ngrok to receive webhooks locally:

bash
# Start ngrok
ngrok http 3000

# Use the ngrok URL for webhooks
# https://abc123.ngrok.io/webhooks/fyber

Testing Subscriptions ​

  1. Create a subscription with a test card
  2. Use the Console to simulate billing cycles
  3. Test payment failure scenarios with decline cards
javascript
// Create subscription with successful card
const sub = await fyber.subscriptions.create({
  customerId: 'cus_test_123',
  tokenId: 'tok_test_456', // From 4242... card
  amount: 999,
  interval: 'month',
});

Testing Installments ​

  1. Check eligibility (always returns eligible in test mode)
  2. Create an installment plan
  3. Payments are simulated on schedule
javascript
// Check eligibility in test mode
const eligibility = await fyber.installments.checkEligibility({
  customerId: 'cus_test_123',
  amount: 50000,
});
// eligibility.eligible = true in test mode

Going Live ​

When ready to accept real payments:

  1. Get live API keys from the Console
  2. Replace sk_test_... with sk_live_...
  3. Update base URL to api.fyber.one
  4. Test with real cards in small amounts
  5. Monitor the Console dashboard
javascript
// Development
const fyber = new Fyber({
  apiKey: process.env.FYBER_TEST_KEY,
  environment: 'test',
});

// Production
const fyber = new Fyber({
  apiKey: process.env.FYBER_LIVE_KEY,
  environment: 'live',
});

Best Practices ​

  1. Use environment variables for API keys
  2. Test all scenarios - success, decline, 3DS, errors
  3. Verify webhook handling with test events
  4. Test edge cases - refunds, cancellations, retries
  5. Start small in live mode - test with small amounts first

Fyber Payment API