DocsClient-Side Usage

Client-Side Usage

Learn how to use PayKit in React applications.

PayKit provides React hooks for seamless client-side integration. The React SDK is a client for the PayKit API that handles the [data, error] pattern automatically and provides loading states.

Basic Setup

Initialize PayKit


Wrap your app with the PayKit provider:


Customer

Creating a Customer


Retrieving a Customer


Updating a Customer


Checkout

Creating a Checkout


Retrieving a Checkout


Subscription

Creating a Subscription


Retrieving a Subscription


Updating a Subscription


Canceling a Subscription


Hook Methods

All PayKit hooks provide consistent methods with .run and .loading to perform the action and give a loading state

  • create - Function to create a resource
  • retrieve - Function to retrieve resource
  • update - Function to update resource
  • cancel - Function to cancel resource (subscription only)