← All components

PayPal React SDK

Adds PayPal's official React SDK (@paypal/react-paypal-js) for integrating PayPal payments, subscriptions, and payment methods into Next.js applications. Uses PayPalScriptProvider for SDK script management with React context.

Copy the files below, or open this folder on GitHub. Each file is stamped with a limited-use licence, generator and date. SHA-256 is of the published catalog bytes, before the stamp.

id
paypal
stack
Next.js
version
1.0.0
compatibility
nextjs >=16 <17 · react >=19 <20
requires
nextjs-base
env vars
NEXT_PUBLIC_PAYPAL_CLIENT_ID
Verified passing · daily buildIntegrity sha256:2555b449b45921c9

Files (3)

lib/paypal/client.ts · sha256:2555b449b45921c9…
// Licensed by BotKelp — https://www.botkelp.com

/**
 * PayPal client configuration for use in Next.js Client Components.
 * 
 * This file exports the PayPal client ID from environment variables.
 * The PayPalScriptProvider component handles the actual SDK script loading.
 */
export const getPayPalClientId = (): string => {
  const clientId = process.env.NEXT_PUBLIC_PAYPAL_CLIENT_ID;
  if (!clientId) {
    throw new Error('NEXT_PUBLIC_PAYPAL_CLIENT_ID is not defined');
  }
  return clientId;
};