TypeScript SDK
Install and start using the TypeScript SDK.
Intro
The Payrix SDK provides access to the Payrix REST APIs.
Worldpay for Platforms provides beta software development kits (SDKs) for the Payrix Pro REST API, auto-generated by APIMatic in .NET, Java, PHP, Python, Ruby, and TypeScript. Use of Payrix Pro SDKs is optional and at your own risk. Worldpay for Platforms does not provide implementation or troubleshooting support for SDK-specific issues. For important limitations, support details, and compliance requirements, see the Payrix Pro API Beta SDKs Disclaimer.
Installation
To add the SDK to your project from npm:
npm install payrix-gp-apimatic-sdkTo install from the SDK source instead, compile it to dist/ — run its build script once in the SDK folder — then add it to your project by path:
npm install <path-to-sdk>Quick Start
Create one client and reuse it. Configure its behaviour through ClientOptions.
import { PayrixClient, ServerEnvironment } from "payrix-gp-apimatic-sdk";
const client = new PayrixClient({
serverEnvironment: ServerEnvironment.Production,
apiKey: "YOUR_API_KEY",
sessionKey: "YOUR_API_KEY",
txnSessionKey: "YOUR_API_KEY",
username: "YOUR_API_KEY",
password: "YOUR_API_KEY",
});Nothing in ClientOptions is required — new PayrixClient() compiles — and each option left out falls back to its default. serverEnvironment is spelled out above so the environment a call reaches is visible where the client is built rather than inherited silently.
From CommonJS
The package ships both dialects from a single entry, so require works with full types. In a TypeScript CommonJS file use the import ... = require(...) form — a plain destructuring require runs fine but gives you any.
import sdk = require("payrix-gp-apimatic-sdk");
const client = new sdk.PayrixClient({
serverEnvironment: sdk.ServerEnvironment.Production,
apiKey: "YOUR_API_KEY",
sessionKey: "YOUR_API_KEY",
txnSessionKey: "YOUR_API_KEY",
username: "YOUR_API_KEY",
password: "YOUR_API_KEY",
});