Installation
npm install stablezact-payLe package fournit un build React et un build autonome pour le navigateur. Les deux communiquent avec la même API.
import { StablezactPayment, PaymentAPI } from 'stablezact-pay';import 'stablezact-pay/dist/style.css';La feuille de style est obligatoire. Sans elle, le checkout s’affiche sans aucun style.
Le checkout accède à window au montage : il ne peut donc pas être rendu côté
serveur. Importez-le dynamiquement :
import dynamic from 'next/dynamic';
const StablezactPayment = dynamic( () => import('stablezact-pay').then((mod) => mod.StablezactPayment), { ssr: false });
// PaymentAPI has no browser dependency and imports normally.import { PaymentAPI } from 'stablezact-pay';import 'stablezact-pay/dist/style.css';JavaScript simple
Section intitulée « JavaScript simple »Chargez le build autonome et utilisez StablezactVanilla. Il ne dépend d’aucun
framework et s’attache lui-même à la page.
TypeScript
Section intitulée « TypeScript »Le package fournit ses propres types. Si votre configuration ne les détecte pas, déclarez le module :
declare module 'stablezact-pay' { export const StablezactPayment: any; export const PaymentAPI: any;}