Install the SDK
The Checkout SDK is available as an NPM package or a CDN bundle, providing flexibility in how it is integrated into a web application. The NPM package includes full TypeScript type declarations, tree-shaking, and separate entry points for the SDK core, features, and runtime contracts. The CDN bundle provides a single-file distribution with configurable feature inclusion and version channels. Both installation methods support the same Checkout initialisation flow, while differing in how the SDK and its features are loaded.
NPM (recommended, TypeScript)
npm install @corefy/checkout-sdk
# or
yarn add @corefy/checkout-sdkThe package ships with full type declarations.
Entry points
| Import | Contents |
|---|---|
@corefy/checkout-sdk |
The init() function, the SDK_VERSION constant, and all public types. |
@corefy/checkout-sdk/features/hpf |
hpfFeature is the card fields feature static for init({ features: [...] }). |
@corefy/checkout-sdk/contracts |
Runtime constants CheckoutErrorType, NextActionType, and DisplayStatusValue allow comparisons without "magic strings". |
import { init } from '@corefy/checkout-sdk';
import { hpfFeature } from '@corefy/checkout-sdk/features/hpf';
import {
NextActionType,
CheckoutErrorType
} from '@corefy/checkout-sdk/contracts';
import type {
CheckoutInstance,
CheckoutError,
NextAction
} from '@corefy/checkout-sdk';In NPM mode, only the core and the features you explicitly import and pass to
featuresend up in your bundle.
CDN (a single script tag)
The CDN bundle is a single file (core + selected features) with no additional downloads in the browser. The features you need are specified in the URL via the ?features= parameter (comma-separated list; all — every feature of the version; no parameter — core only):
<script src="https://pay.example.com/cdn/v1/sdk.js?features=hpf"></script>| URL | Version channel |
|---|---|
/cdn/v1/sdk.js?features=hpf |
Floating major channel: you automatically receive minor/patch updates within v1. Recommended by default. |
/cdn/v1.0.4/sdk.js?features=hpf |
Exact version pin (immutable). Required for SRI (integrity); the hashes of every build are published in /cdn/v1.0.4/manifest.json. |
The script exposes the global window.CheckoutSDK namespace and calls window.CheckoutSDKReady if you defined it. Features included in the bundle are already registered, so there is no need to pass features to init():
<script src="https://pay.example.com/cdn/v1/sdk.js?features=hpf"></script>
<script>
window.CheckoutSDKReady = async function () {
const checkout = await window.CheckoutSDK.init({
baseUrl: 'https://pay.example.com', // the same domain the script came from
apiKey: 'pk_…',
merchantAccountId: 'ma_…',
paymentRequestId: 'pr_…',
featureOptions: {
/* … */
},
});
};
</script>Updated about 19 hours ago

