Skip to main content

@paymint/react

React hooks for Paymint billing.

Installation

Note: For Next.js apps, use @paymint/nextjs instead - it includes everything from this package plus server utilities.

Quick Start

1. Set up Provider

2. Use Hooks

Hooks

useBilling()

Combined billing data (products + subscription).

useProducts()

Available products only.

useSubscription()

Subscription management.

useCheckout()

Paddle checkout integration.

Provider Props

Post-Checkout Success Handling

Option 1: onCheckoutComplete Callback

Option 2: Paddle’s successUrl

Note: Subscriptions are created via webhooks. There may be a 1-5 second delay between payment and subscription appearing in the database.

Backend Required

This package requires a backend API that proxies to Paymint. The provider calls:
Use @paymint/server or @paymint/nextjs to create these endpoints.

Security

Backend Developer Responsibilities

When creating your backend API route, ensure:

1. Get Email from Auth Session (CRITICAL)

2. Keep API Key Server-Side

What Paymint Handles

  • API key encryption
  • Subscription ownership verification
  • Paddle API security
  • Webhook signature verification

What Your Backend Must Handle

  • Authenticate users before billing operations
  • Get email from auth session (not request body)
  • Keep API key server-side only

License

MIT