Skip to main content

Sandbox

The sandbox environment is an isolated test space connected to AccruPay's QA infrastructure. No real charges occur — all payment operations are simulated by each provider's test system.

Enable sandbox mode

Node SDK

Pass environment: 'sandbox' to the constructor:

import AccruPay, { TRANSACTION_PROVIDER, CURRENCY, COUNTRY_ISO_2 } from '@accrupay/node';

const sdk = new AccruPay({
apiSecret: process.env.ACCRUPAY_API_SECRET_SANDBOX,
environment: 'sandbox',
});

When environment is 'sandbox', the SDK routes all requests to:

https://api.qa.pay.accru.co/graphql

React SDK

Pass environment="sandbox" to the AccruPay provider:

import { AccruPay, CardNumber, CardExpiry, CardCVC, CardholderName, SubmitButton } from '@accrupay/react';

export function Checkout({ sessionId }: { sessionId: string }) {
return (
<AccruPay
merchantPublicId={process.env.NEXT_PUBLIC_ACCRUPAY_MERCHANT_PUBLIC_ID_SANDBOX}
transactionSessionId={sessionId}
environment="sandbox"
>
<CardholderName />
<CardNumber />
<CardExpiry />
<CardCVC />
<SubmitButton>Pay now</SubmitButton>
</AccruPay>
);
}
Use sandbox credentials in sandbox

Sandbox and production environments have separate API keys. Using a production apiSecret against the sandbox endpoint (or vice versa) will fail authentication. Keep both sets of credentials in your environment and switch them alongside the environment flag.

Test payment methods

Test card numbers are specific to each payment provider. Use any future expiry date and any 3-digit CVV unless noted otherwise.

Test cards by provider
Nuvei
Card numberBrandBehavior
4111111111111111VisaApproved
5111111111111118MastercardApproved
4444333322221111VisaApproved
4000000000000002VisaDeclined
4000000000000077Visa3DS challenge

See the Nuvei testing docs for the full list including specific decline codes.

Stripe
Card numberBrandBehavior
4242424242424242VisaSucceeds
5555555555554444MastercardSucceeds
4000000000000002Visacard_declined
4000000000009995Visainsufficient_funds
4000000000000101VisaCVC check fails
4000002500003155Visa3DS authentication required

See the Stripe testing docs for the full list.

Sandbox vs. production comparison

SandboxProduction
API endpointapi.qa.pay.accru.coapi.pay.accru.co
ChargesNone — simulatedReal charges
API keysSandbox credentialsProduction credentials
environment value'sandbox''production' (default)
Provider behaviorProvider test modeLive provider

Use environment variable prefixes to avoid accidentally mixing credentials:

# .env.local (never commit this file)
ACCRUPAY_API_SECRET=sk_sandbox_...
NEXT_PUBLIC_ACCRUPAY_MERCHANT_PUBLIC_ID=pub_sandbox_...
# .env.production
ACCRUPAY_API_SECRET=sk_live_...
NEXT_PUBLIC_ACCRUPAY_MERCHANT_PUBLIC_ID=pub_live_...

Then derive the environment flag from a single variable rather than duplicating it across every SDK call:

const sdk = new AccruPay({
apiSecret: process.env.ACCRUPAY_API_SECRET,
environment: process.env.ACCRUPAY_ENVIRONMENT === 'production' ? 'production' : 'sandbox',
});

Next steps

  • Go Live — checklist before switching to production
  • Provider Integrations (sidebar) — provider-specific test credentials and behavior