Skip to main content
Handle errors from the Billing SDK using structured error classes. Each error type provides specific information to help you debug issues and display appropriate messages to your users.

Error classes

The SDK includes the following error types:
  • ValidationError - Invalid input or configuration (e.g., missing required fields, invalid field values)
  • APIError - API-level errors from the Funnelfox backend (e.g., invalid price, double purchase, payment failures)
  • PrimerError - Errors originating from the Primer SDK during payment processing
  • CheckoutError - Errors during the checkout lifecycle (e.g., initialization or state management issues)
  • NetworkError - Network connectivity or request failures

Handle errors

You can catch and handle each error type to provide appropriate user feedback:

Common error codes

  • double_purchase - User already has an active subscription
  • invalid_price - Price ID not found
  • invalid_customer - Customer data validation failed
  • payment_failed - Payment processing failed