@sumup/sdk
v0.1.2
Published
The official TypeScript SDK for the SumUp API
Downloads
4,102
Readme
SumUp Node.js SDK
IMPORTANT: This SDK is under development. We might still introduce minor breaking changes before reaching v1.
The Node.js SDK for the SumUp API.
To learn more, check out our API Reference and Developer Documentation. You can also find the full documentation of the SumUp Node.js SDK at sumup.github.io/sumup-ts.
Requirements
Node 18 or higher.
Installation
Install the package with:
npm install @sumup/sdk
# or
yarn add @sumup/sdkInstall from jsr:
deno add jsr:@sumup/sdk
# or
npx jsr add @sumup/sdkUsage
const sumup = require('@sumup/sdk')({
apiKey: 'sup_sk_MvxmLOl0...'
});
sumup.checkouts.list()
.then(checkouts => console.info(checkouts))
.catch(error => console.error(error));Or using ES modules and async/await:
import SumUp from "@sumup/sdk";
const client = new SumUp({
apiKey: 'sup_sk_MvxmLOl0...',
});
const merchantCode = process.env.SUMUP_MERCHANT_CODE!;
const merchant = await client.merchants.get(merchantCode);
console.info(merchant);Per-request options are available as the last argument to any SDK call. For example, you can override authorization, timeout, retries, or headers for a single request:
await client.checkouts.list(undefined, {
timeout: 5_000,
});
await client.merchants.get(merchantCode, {
authorization: `Bearer ${accessToken}`,
headers: {
"x-request-id": "req_123",
},
maxRetries: 1,
});Examples
Examples require an API key and your merchant code. You can run the examples using:
npx tsx examples/checkout/index.ts