This is a quickstart example of how to use the ETOPay SDK to create a new wallet and generate the first receiver address. This node-example is developed with Typescript.
The ETOPay SDK is available on NPM, making it easy to integrate into your project. You can find it here:
- Node - ETOPay SDK Node.
To install it as a dependency, simply run the following command in your project directory:
bun install @etospheres/etopay-sdk-wasm-nodeCurrently, we only support
bunfor running the SDK, asnodedoes not work correctly with the current version. We recommend usingbunto ensure proper functionality.
This will add the ETOPay SDK to your project, and you'll be ready to start using it (as it is already done in this example) ! 😊
- Copy the .env.example file to .env and set the missing values
- Go to
https://etopayapp.etospheres.comand get the SDK configuration for you project - Create
config.jsonand set the SDK configuration in the file at the top-level directory. - Run the node example with
bun src/index.ts
If testing with the same user again, remove the local-storage folder. Since this folder contains the local user and their wallet settings, make sure you have back-ed up the mnemonic before removing. Do not attempt removal of local storage in production and ensure a safe and secure backup mechanism for the local storage.
Curl snippet to get an access_token.
curl -X POST "https://auth-etopay.etospheres.com/realms/<realm>/protocol/openid-connect/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=password" \
-d "scope=profile email openid" \
-d "client_id=<client_id>" \
-d "client_secret=<client_secret>" \
-d "username=<user_name>" \
-d "password=<user_password>"