DocsError Handling

Error Handling

Learn how to handle errors in PayKit.

PayKit uses a consistent error handling pattern across all operations. Every method returns a tuple [data, error] that you can destructure to handle both success and error cases.

Basic Pattern

All PayKit methods return [data, error]:


Customer Examples


Checkout Examples


Subscription Examples


Client-Side React Example


API Route Example