Skip to main content

Set up

The Tezos Payments JavaScript package supports Node.js 16.7.0 or later. Make sure that you have the supported version:

node --version

Install the JavaScript package​

Add the package to your project:

npm install --save tezospayments

Set up the Tezos Payments​

Tezos Payments (TezosPayments) is a class with which you’ll create payment links. One instance is used for one service.
Create an instance of the TezosPayments class:

import { TezosPayments } from 'tezospayments';

// ...

const tezospayments = new TezosPayments({
serviceContractAddress: '<contract address of your service>',
signing: {
apiSecretKey: '<API secret key of this service>'
}
});

If you need to specify a network use the network option:

import { TezosPayments } from 'tezospayments';

// ...

const tezospayments = new TezosPayments({
serviceContractAddress: '<contract address of your service>',
signing: {
apiSecretKey: '<API secret key of this service>'
},
network: { name: 'hangzhounet' }
});