pay.sh docs
SDKPython

Errors

The solana_pay_kit exception hierarchy raised at configure/boot time, and how per-request payment failures become the 402 response.

All solana_pay_kit exceptions derive from PayKitError. Configuration problems raise at configure / boot time — before serving traffic — while proof failures raise during verification and are translated into the 402 response by the framework shim (your view only runs once a payment verifies).

Exception types

ExceptionWhen it raises
PayKitErrorBase class for every exception below.
ConfigurationErrorInvalid config, gate, or fee (base class for the boot-time errors).
DemoSignerOnMainnetErrorThe demo signer was used on solana_mainnet — refused so real funds never route to a public key.
MixedCurrenciesErrorA gate's fees and amount don't share one denomination.
ProtocolIncompatibleErrorA fee-bearing gate was restricted to accept=(Protocol.X402,); fees need MPP.
InvalidKeyErrorKey material couldn't be parsed into a signer.
InvalidProofErrorA submitted payment credential failed verification.
ChallengeExpiredErrorA payment arrived against an expired 402 challenge (subclass of InvalidProofError).
PaymentRequiredErrorNo valid payment was present where one was required.
ProtocolNotSupportedErrorA requested protocol has no registered adapter.

Boot-time safety rails

  • network="solana_mainnet" with the published demo signer raises DemoSignerOnMainnetError.
  • A missing MPP challenge-binding secret is resolved from the environment (falling back to ./.env, generating and persisting one if neither exists) so the HMAC stays stable across restarts. Override with PAY_KIT_MPP_CHALLENGE_BINDING_SECRET.

On this page