Skip to main content

Stripe Integration

Stripe is a payment service provider (PSP) supported by AccruPay. When you configure Stripe as a transaction provider, AccruPay routes payment sessions through Stripe's infrastructure and the React SDK initializes Stripe.js automatically using your publishable key.


Supported features

FeatureSupported
Card checkout
Stored cards
Server charges
ACH
Auth & capture
Payment plans
Webhooks

ACH is not supported via AccruPay's Stripe integration. Use Nuvei if you need ACH.


Connecting Stripe

  1. Log in to the AccruPay dashboard.
  2. Navigate to Settings → Transaction Providers → Add Provider.
  3. Select Stripe and enter your Stripe secret key.
  4. Save. AccruPay will use this key server-side when creating PaymentIntents and SetupIntents.

Your Stripe publishable key is returned by AccruPay as part of the session baseConfig — AccruPay retrieves it automatically from Stripe when you save your secret key.

Once connected, use TRANSACTION_PROVIDER.STRIPE when starting sessions from the Node SDK.


TRANSACTION_PROVIDER enum value

import { TRANSACTION_PROVIDER } from '@accrupay/node';

// Use this value when starting Stripe sessions
transactionProvider: TRANSACTION_PROVIDER.STRIPE

Base config

When you start a payment session with TRANSACTION_PROVIDER.STRIPE, AccruPay returns a baseConfig object alongside the session token. The React SDK consumes this automatically.

// Shape of the baseConfig returned by start() for Stripe sessions
{
publicKey: string; // Stripe publishable key (pk_live_... or pk_test_...)
}

The React SDK calls loadStripe(publicKey) internally using @stripe/react-stripe-js. You do not need to initialize Stripe yourself.


React SDK behavior

The React SDK uses @stripe/react-stripe-js under the hood. When the session's provider resolves to STRIPE, the SDK:

  1. Calls loadStripe(baseConfig.publicKey) to load Stripe.js from https://js.stripe.com.
  2. Wraps the payment form in a Stripe Elements provider.
  3. Uses session.token (the Stripe client_secret) to confirm the PaymentIntent or SetupIntent.

You do not need to install @stripe/react-stripe-js or call loadStripe yourself.


Session token

For Stripe sessions, session.token is the Stripe client secret of the underlying PaymentIntent or SetupIntent. The React SDK uses it internally to call confirmCardPayment or confirmCardSetup. You do not need to pass the client secret to Stripe directly.


Content Security Policy

Stripe.js loads from https://js.stripe.com. Add this domain to your script-src and frame-src directives:

Content-Security-Policy:
default-src 'self';
script-src 'self' https://js.stripe.com;
frame-src 'self' https://js.stripe.com;
connect-src 'self' https://api.stripe.com;
img-src 'self' data:;
style-src 'self' 'unsafe-inline';

Stripe also makes API calls to https://api.stripe.com from the browser — include it in connect-src to avoid blocked requests.


Sandbox setup

To use the Stripe test environment:

  1. Set environment: 'sandbox' in your AccruPay SDK (Node and React).
  2. AccruPay will use your Stripe test-mode secret key and return the corresponding test-mode publishable key in baseConfig.
  3. The React SDK initializes Stripe.js in test mode automatically.

Node SDK:

import AccruPay from '@accrupay/node';

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

React SDK:

<AccruPay
merchantPublicId="your-merchant-public-id"
transactionSessionId={sessionId}
environment="sandbox"
>
{/* payment fields */}
</AccruPay>

In the AccruPay dashboard, configure both a live-mode secret key and a test-mode secret key for your Stripe provider so that sandbox sessions use test credentials.


Test cards

Use these card numbers in the Stripe test environment. Any future expiry date, any 3-digit CVV, and any 5-digit ZIP code are accepted.

Card numberTypeBehavior
4242424242424242VisaSucceeds
4000000000000002VisaDeclined — card_declined
4000000000009995VisaDeclined — insufficient_funds
4000002500003155VisaRequires 3DS authentication

For the complete list of Stripe test card numbers including specific decline codes and payment method types, see the Stripe testing documentation.


3D Secure

3DS authentication is handled automatically by Stripe.js. When the PaymentIntent or SetupIntent requires authentication, Stripe.js opens the challenge modal without any code changes on your part.

The React SDK onSuccess callback fires only after the full 3DS flow and charge confirmation complete. If the customer abandons or fails the 3DS challenge, the SDK surfaces an error you can handle in onError.


Session TTL

Session lifetime is controlled by the Stripe PaymentIntent or SetupIntent expiry. Stripe PaymentIntents expire after 24 hours by default; SetupIntents do not expire. If the PaymentIntent expires before the customer completes payment, start a new AccruPay session — this creates a new PaymentIntent automatically.


Webhooks

AccruPay registers a webhook endpoint URL with Stripe for your merchant account. Find this URL in the AccruPay dashboard under Settings → Transaction Providers → Stripe → Webhook URL, then add it in your Stripe dashboard under Developers → Webhooks.

Stripe sends event notifications (e.g. payment_intent.succeeded, payment_intent.payment_failed) to AccruPay; AccruPay updates the corresponding transaction or payment plan record. Your application reads the updated state via the GraphQL API. See Webhooks for the full processing model.