Which SDK should I use?
Use the TypeScript SDK in trusted server-side code to create payments, retrieve transactions, issue refunds, and create transfers. Use the browser SDK v3 through Payment Element when you need hosted card fields in a checkout page.Requirements
- TypeScript or JavaScript running on your backend.
- A Pagou secret key for the environment you are calling.
- A runtime with
fetch. If your runtime does not expose globalfetch, inject a custom implementation in the client options.
Install
Create a client
You can also pass
baseUrl for development tests or controlled proxies.
Response shape
SDK methods return{ data, meta }. data is the API payload. meta contains HTTP metadata and the request ID used for tracing.
First Pix payment
Request options
Every resource method accepts an optional second argument:Auth variants
Bearer auth is the default and recommended setup.Retry behavior
- Retries cover network failures and
429,500,502,503,504. GETandHEADretry automatically.POSTandPUTretry only when you setidempotencyKey.- Default retry count is
2. - Default timeout is
30_000ms.
Error handling
AuthenticationError, PermissionError, RateLimitError, InvalidRequestError, NotFoundError, ConflictError, ServerError, and NetworkError.

