Safepay logo
Docs
Safepay logo
Launch Safepay

Node JS SDK

Learn how to integrate Safepay into your Node JS backend application


A set of components allowing easy integration of Safepay Button and Safepay Checkout into your website, powered by zoid

1. Install through NPM or Yarn

In your project root you can run either one of the below commands (depending on what package manager you use)

Yarn

NPM

Install using Yarn:

$ yarn add @sfpy/node-sdk

2. Import

Import from the Safepay library

3. Create a Safepay client by passing your config

You can now create payments and checkout links.

4. Set currency and amount

Since we're huge fans of React at Safepay, we've integrated this library into our products like Quick Links through the following React integration that ships out of the box with this library

5. Create checkout link

Since we're huge fans of React at Safepay, we've integrated this library into our products like Quick Links through the following React integration that ships out of the box with this library

Ending Step

Since we're huge fans of React at Safepay, we've integrated this library into our products like Quick Links through the following React integration that ships out of the box with this library

Ending Step

Since we're huge fans of React at Safepay, we've integrated this library into our products like Quick Links through the following React integration that ships out of the box with this library

Feedback

What do you think of our integration document? Let us know here support@getsafepay.com

import { Safepay } from '@sfpy/node-sdk'
const safepay = new Safepay({
environment: 'sandbox',
apiKey: 'sec_asd12-2342s-1231s',
v1Secret: 'bar',
webhookSecret: 'foo'
})
const { token } = await safepay.payments.create({
currency: "PKR",
amount: 1000
})
// Pass 'token' to create checkout link
const url = safepay.checkout.create({
token,
orderId: 'T800',
cancelUrl: 'http://example.com/cancel',
redirectUrl: 'http://example.com/success',
source: 'custom',
webhooks: true
})
Previous
React Native SDK
Next
Java SDK