Pay3 Javascript SDK

Transactions

5min
pay3pay opencheckout(checkoutobj) the application can use opencheckout to use pay3's fiat only solution here the pay3 modal will guide user through fiat payment services and deposit the payment to the app's fiat account parameters requestid (type string) app needs to generate a unique identifier for every checkout call this id will be provided in the javascript events and webhooks callbacks this id can be used by the app to identify and update state in app's backend user (type object) user details can be passed to pay3 in this object email (type string) provide valid email address of user this data will be passed to paymen partner during the fiat checkout flow payment partner might send mails to user updating them status of their transaction id (optional type uuid) it will used as unique identifier of the user if this is not present, email will be used as a unique identifier of the user within pay3 firstname (optional type string) first name of the user with maximum length of 50 characters lastname (optional type string) last name of the user with maximum length of 50 characters taxid (optional type string) this is country specific tax identifier of the user for example for users of brazil, it is the cpf number phonenumber (optional type string) this is the phone number of the user in e 164 format \[+]\[country code]\[number including area code] which can have a maximum of fifteen digits pixkey (optional type string) this is the unique identifier for a user in the pix system, provided by the user it can be an email address, phone number, cpf, or a random key intlbankaccount (optional type string) this is the international bank account number (iban) entered by the user it follows the standard iban format, which includes the country code, check digits, and the bank account number bankaccount (optional type string) this is the bank account number entered by the user it is specific to the user's bank and is used to identify the user's account within the financial institution doctype (optional type string) this specifies the type of document, which for instance for brazil is cpf (cadastro de pessoas físicas) cpf is the brazilian individual taxpayer registry identification docid (optional type string) this is the documentation id, entered by the user it corresponds to the specific identifier for the type of document (e g , cpf number) provided payment (type array of objects ) this section provides is the amount payable by the user of your platform it could be cost price of your digital asset user wishes to checkout amount (type string) string representing currency amount in two decimal precision the amount is provided separately for each supported currency name (type string) name of the currency supported in the purchase flow the name will be provided by pay3 during onboarding paymentmethodkey (optional type string) payment method key indicates the payment method that is suitable for the payment currency specified in name this could help in customization of the user interface this is considered only if the payment array has a single object usermessage (type string) short meaningful name of the asset user is about to purchase mode (optional type enum string) application can take full control on how the pay3 payment model showed up using this option returnurl in this mode, the opencheckout() will return a pay3 payment url which can be used to embed within clients application this is useful when the client need to open pay3 url with in a webview (in react native application) or iframe redirect in this mode the open checkout() function will redirect user from application's page to pay3 payment page where user can complete the payment default if this parameter is not sent or does not match above values, pay3 sdk will open a new window/tab while application page will be accessible to the user in the background callbackurl (optional type url) application can provide a url in this parameter after completion of the transaction, user will be redirected to this url an additional parameter data query parameter will be added to the url refer callback url docid\ dta9vnslmbs8xh71p53ux for more details const checkoutobj = { "requestid" requestid, "user" { "email" "user\@email address", "firstname" "john", "lastname" "doe", "taxid" "39053344705", "phonenumber" "+5511123456789", }, "payment" \[ { "amount" "20 25", "name" "brl bz", "paymentmethodkey" "pix" } ] }; // opens pay3 checkout modal pay3pay opencheckout(checkoutobj); pay3pay openpayout(payoutobj) the application can use openpayout to use pay3's fiat withdraw solution once this function is called, the pay3 modal will guide the user through the withdraw of funds flow the funds will be deposited into users' account this needs to be called after calling create payout order docid\ cz cutnjfgefe eokawio from application's backend parameters requestid (type string) app needs to generate a unique identifier for every payout call this id will be provided in the javascript events and webhooks callbacks this id can be used by the app to identify and update state in app's backend token (type string) this is a unique id generated by pay3 backend on calling create payout order docid\ cz cutnjfgefe eokawio this is to identify the approved order created by application's backend mode (optional type enum string) application can take full control on how the pay3 payment model showed up using this option returnurl in this mode, the opencheckout() will return a pay3 payment url which can be used to embed within clients application this is useful when the client need to open pay3 url with in a webview (in react native application) or iframe redirect in this mode the open checkout() function will redirect user from application's page to pay3 payment page where user can complete the payment default if this parameter is not sent or does not match above values, pay3 sdk will open a new window/tab while application page will be accessible to the user in the background callbackurl (optional type url) application can provide a url in this parameter after completion of the transaction, user will be redirected to this url an additional parameter data query parameter will be added to the url refer callback url docid\ dta9vnslmbs8xh71p53ux for more details const payoutobj = { "requestid" requestid, "token" pay3createdtokenid }; // opens pay3 payout modal pay3pay openpayout(payoutobj); pay3pay opencryptocheckout( transactionobj ) 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 user can connect their wallet and pay through the connected wallet or users can deposit using qr code for detailed understanding please refer to end user flow crypto payin docid djtmc3ovtqzxol7rytnt this needs to be called after calling create checkout order docid\ twxek26s1fefj4vbxdno7 from application's backend the digital asset purchased will be deposited into the wallet address provided in the create checkout order docid\ twxek26s1fefj4vbxdno7 parameters requestid (type string) app needs to generate a unique identifier for every opencryptocheckout call this id will be provided in the javascript events and webhooks callbacks this id can be used by the app to identify and update state in app's backend token (type string) this is a unique id generated by pay3 backend on calling create crypto checkout order this is to identify the request created by application's backend mode (optional type enum string) application can take full control on how the pay3 payment model showed up using this option returnurl in this mode, the opencryptocheckout() will return a pay3 payment url which can be used to embed within clients application this is useful when the client need to open pay3 url with in a webview (in react native application) or iframe redirect in this mode the opencryptocheckout() function will redirect user from application's page to pay3 payment page where user can complete the payment default if this parameter is not sent or does not match above values, pay3 sdk will open a new window/tab while application page will be accessible to the user in the background callbackurl (optional type url) application can provide a url in this parameter after completion of the transaction, user will be redirected to this url an additional parameter data query parameter will be added to the url refer callback url docid\ dta9vnslmbs8xh71p53ux for more details token buy flow where destination address is game's wallet address index js const transactionobj = { "requestid" requestid, "token" pay3createdtokenid }; // opens pay3 crypto checkout modal await pay3 opencryptocheckout(transactionobj);