Installation
With npm
Our Web SDK is available on npm under the name @primer-io/checkout-web
.
This package includes TypeScript definitions.
12345
# With yarnyarn add @primer-io/checkout-web # With npmnpm install --save @primer-io/checkout-web
bash
copy
12345
import { Primer } from '@primer-io/checkout-web' Primer.showUniversalCheckout(clientToken, { /* Options */})
typescript
copy
With our CDN
Include the Primer.min.js
script and the Checkout.css
stylesheet on the page where you want to render the Checkout.
Make sure to pass the proper version in the URL.
12
<link rel="stylesheet" href="https://sdk.primer.io/web/v2.0.0/Checkout.css" /><script src="https://sdk.primer.io/web/v2.0.0/Primer.min.js" crossorigin="anonymous"></script>
html
copy
The Primer.min.js
will add the Primer
object to the global scope:
12345
const { Primer } = window Primer.showUniversalCheckout(clientToken, { /* Options */})
typescript
copy