Skip to main content

TypeScript SDK

The @openpay/sdk package provides a fully typed client for Node.js, Deno, Bun, and edge runtimes.

Installation

Initialization

Never expose your apiSecret in client-side code. The SDK is designed for server-side use only.

Create a Payment

Create a payment request that a customer can pay with crypto.

Create a Checkout Session

Checkout sessions generate a hosted payment page. Redirect your customer to the returned URL.
The session response includes:

Verify Webhook Signature

When Open Pay sends a webhook to your server, verify the ED25519 signature before processing.
Always return a 200 status within 10 seconds. If your endpoint fails or times out, Open Pay retries with exponential backoff (up to 5 attempts over 24 hours).

List Payments

Error Handling

The SDK throws typed errors with status codes and messages.

TypeScript Types

The SDK exports all request and response types: