pay.sh docs
SDKTypeScript

Errors

The pay-kit error types and the boot-time safety rails that catch misconfiguration before any traffic.

All pay-kit errors extend PayKitError, so you can catch the base class to handle any of them. Configuration problems throw when createPayKit runs — at boot, before serving traffic — while proof and protocol errors surface per request during verification.

import { PayKitError, ConfigurationError } from '@solana/pay-kit';

try {
  pay = await createPayKit({
    /* … */
  });
} catch (err) {
  if (err instanceof ConfigurationError) {
    // a gate, fee, or operator setting is invalid — fix config and restart
  }
}

Error types

ErrorWhen it throws
PayKitErrorBase class for every error below.
ConfigurationErrorInvalid gate, fee, or operator config (base class for the boot-time errors below).
DemoSignerOnMainnetErrorsolana_mainnet combined with the published demo signer — refused so real funds never route to a public key.
ProtocolIncompatibleErrorA gate's accept can't support its shape — e.g. accept: ['x402'] on a fee-bearing gate (fees need MPP).
ProtocolNotSupportedErrorA requested protocol has no shipped adapter.
MixedCurrenciesErrorA gate's fees and amount don't share one currency.
UnknownGateErrorA gate name was referenced that isn't in the pricing catalogue.
InvalidKeyErrorKey material couldn't be parsed into a signer.
InvalidProofErrorA submitted payment credential failed verification.
ChallengeExpiredErrorA payment arrived against an expired 402 challenge.
PaymentRequiredErrorNo valid payment was present where one was required.

Boot-time safety rails

Outside localnet, two checks fire when createPayKit runs:

  • solana_mainnet plus the published demo signer throws DemoSignerOnMainnetError.
  • A missing mpp.challengeBindingSecret throws — provide it in createPayKit or via PAY_KIT_MPP_SECRET so the HMAC binding challenges stays stable across restarts. On localnet an ephemeral secret is generated with a warning.

On this page