Skip to main content

Environments

AccruPay has two environments: production and sandbox. Each has its own API endpoint and its own set of provider credentials.

Comparison​

ProductionSandbox
GraphQL endpointhttps://api.pay.accru.co/graphqlhttps://api.qa.pay.accru.co/graphql
Charges real moneyYesNo
Provider accountsLive credentialsTest credentials
API secretProduction secretSandbox secret
warning

Sandbox transactions do not move real money. Never use sandbox credentials in a production checkout, and never use production credentials in a test environment.

Node SDK​

Set environment in the constructor. The SDK defaults to 'production' if omitted.

import AccruPay from '@accrupay/node';

// Sandbox
const sandboxSdk = new AccruPay({
apiSecret: process.env.ACCRUPAY_API_SECRET, // your sandbox secret
environment: 'qa', // the Node SDK names the sandbox environment 'qa'
});

// Production
const productionSdk = new AccruPay({
apiSecret: process.env.ACCRUPAY_API_SECRET, // your production secret
environment: 'production',
});

Alternatively, set url directly to override the endpoint regardless of environment:

const sdk = new AccruPay({
apiSecret: process.env.ACCRUPAY_API_SECRET,
url: 'https://api.qa.pay.accru.co/graphql', // sandbox endpoint
});
tip

Use environment variables to switch between environments without code changes:

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

React SDK​

Pass environment as a prop on the <AccruPay> component. It defaults to 'production' if omitted.

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

const env = process.env.NEXT_PUBLIC_ACCRUPAY_ENVIRONMENT as 'production' | 'sandbox';

export function Checkout({ sessionId }: { sessionId: string }) {
return (
<AccruPay
merchantPublicId={process.env.NEXT_PUBLIC_ACCRUPAY_MERCHANT_ID}
transactionSessionId={sessionId}
environment={env}
>
<CardNumber />
<CardExpiry />
<CardCVC />
<SubmitButton>Pay now</SubmitButton>
</AccruPay>
);
}

Both the Node SDK environment and the React SDK environment prop must match. A session started against the sandbox endpoint must be verified against the sandbox endpoint, and the React SDK must point at sandbox as well.

Test payment methods​

Test card numbers and test payment method behavior vary by provider. See the Provider Integrations section in the sidebar for test credentials specific to each provider.

Next steps​

  • Quick Start — end-to-end example you can run in sandbox
  • Provider Integrations (see sidebar) — sandbox test credentials per provider
  • Node SDK Configuration — full list of Node SDK options