Getting Started

Quick Start

7min
get started with pay3 javascript sdk with a few lines of code pay3 sdk is designed to work in any javascript based client side application and work with most of the popular frontend frameworks like react pay3 also provides sdks for react native, flutter and unity install the pay3 js sdk is available at the public npm registry @pay3/sdk you can install and add to your app using the following command npm install @pay3/sdk save initialization import the package installed in the previous step using import directive create a instance of pay3 by passing the parameters you received during onboarding quick start docid\ mxtd0gunckc5votu8masq index js // import pay3 package import { initpay3 } from '@pay3/sdk'; // new instance const pay3 = initpay3({ hostname "https //pay3 hostname shared by pay3", clientid "client uuid shared by pay3", ispaymentmode true }); fiat payin pay3 web modal provides a comprehensive digital asset purchase buy flow user is able to choose a payment method and buy the digital asset using currencies across the globe the request object requires a string requestid this will be passed back along with the event emitted on completion of the buy flow detailed documentation of opencheckout is present at transactions docid\ wr9g8 0vvao95lsm3g1ye index js pay3 opencheckout({ requestid "dapp can pass unique id" "user" { "email" "user email\@address" }, "payment" \[ { "amount" "2 00", "name" "brl bz", }, { "amount" "4 05", "name" "usd usa", } ], "usermessage" "checkout sample" }); fiat payout pay3 web modal provides a withdraw functionality to users where they can receive funds in their local currency user will be able to provide either bank details or local e wallets to receive the funds detailed documentation of openpayout is present at transactions docid\ wr9g8 0vvao95lsm3g1ye the request object requires a string requestid and the token which is a unique id generated by pay3 backend on calling create payout order docid\ cz cutnjfgefe eokawio index js // opens pay3 payout modal pay3pay openpayout( { "requestid" requestid, "token" pay3createdtokenid }); crypto payin this function opens pay3 buy crypto modal the buy modal will guide the user through the digital asset purchase flow using user's own digital assets like coins and erc20 tokens detailed documentation of opencryptocheckout is present at transactions docid\ wr9g8 0vvao95lsm3g1ye the request object requires a string requestid and the token which is a unique id generated by pay3 backend on calling create create checkout order docid\ twxek26s1fefj4vbxdno7 index js // opens pay3 crypto checkout modal pay3 opencryptocheckout({ "requestid" requestid, "token" pay3createdtokenid }); listen to transaction status events on completion of the transaction flow an event is emitted with type pay3 sdk transaction status the event data consists of fields status which is set to 'success' when transaction is completed successfully the orderid is pay3's transaction id and requestid is the unique string passed by the application in opencheckout call quick start docid\ mxtd0gunckc5votu8masq index js pay3 on('pay3 sdk transaction status', (event) => { console log("\[dapp] received transaction status", event data); const {status, orderid, requestid, message} = event data; });