Pay3 Javascript SDK

Event Listeners

7min

Introduction

After completing transactions in Pay3 Wallet Modal, the Pay3 SDK publishes events to DApp.

pay3-sdk-login-status:

This event is fired by Pay3 SDK in the following scenarios

On Page load / Refresh

  1. On successful login after calling pay3.connect()
  2. On successful logout after calling pay3.disconnect()

Payload

  1. data (Type Object): Following keys are present in this object.
    1. isLoggedIn (Type boolean): true if user is loggedIn false otherwise.
    2. address (Type string or null): Wallet address of connected user. It has value null if user is not logged in.
  2. error (Type Object, Optional): Following keys will be present if there is an error. Please refer to SDK Errors for reference.
    1. code (Type number): Error code.
    2. message (Type string): Error message.
index.js


pay3-sdk-sendtxn-status

This event is fired by Pay3 SDK in following scenario:

  1. On completion of the custom transaction triggered by pay3.sendTransaction()

Payload

  1. data (Type Object): Following keys are present in this object
    1. status (Type string): The status can have values SUCCESS or ERROR.
    2. message (Type string): User-friendly message returned after completion of the transaction.
    3. requestId (Type string): Unique id passed by dApp.
    4. receipt (Type Object or null): Transaction receipt returned by the chain after the transaction completion.
  2. error (Type Object, Optional): Following keys will be present if there is an error. Please refer to SDK Errors for reference.
    1. code (Type number): Error code
    2. message (Type string): Error message
index.js


pay3-sdk-transaction-status

This event is fired by Pay3 SDK in following scenario

  1. On completion of Buy transaction triggered by pay3.openBuy()
  2. On completion of Sell transaction triggered by pay3.openSell()

Payload

  1. data (Type Object): Following keys are present in this object
    1. status (Type string): The status can have values SUCCESS or ERROR.
    2. message (Type string): User-friendly message returned after completion of the transaction.
    3. orderId (Type string): Pay3 Order ID.
    4. requestId (Type string): Unique id passed by dApp.
    5. receipt (Type Object or null): Transaction receipt returned by the chain after the transaction completion.
  2. error (Type Object, Optional): Following keys will be present if there is an error. Please refer to SDK Errors for reference.
    1. code (Type number): Error code.
    2. message (Type string): Error message.
index.js




Updated 25 Mar 2024
Doc contributor
Did this page help you?