Quickly broadcast transactions on behalf of your users to one of our supported public blockchain networks without having to buy or hold cryptocurrency or tokens.
import { bookieClientFactory, identClientFactory } from'provide-js';constappId='<provide app id>'; // the app idconstappAccessToken='<signed jwt>'; // application token// initialize ident instance for the applicationconstident=identClientFactory(accessToken);// create a virtual application userconstvirtualUser=awaitident.createUser({ application_id: appId, email:`joe.user.${newDate().getTime()}@example.com`, first_name:'Joe', last_name:'User',})console.log(virtualUser.id); // associate this id with your local userconstuserAccessToken= (awaitident.createToken({ application_id: appId, user_id:virtualUser.id, scope:'offline_access',})).accessToken!;// the refresh token is also returned here and should also be persisted// and used to create future access tokens...// initialize bookie (api.providepayments.com) instance for the userconstbookie=bookieClientFactory(userAccessToken);// create a payment for the user...constpayment=awaitbookie.createPayment({ data:'0x', network:'ropsten',});