Skip to content

ghas-results/dlocal-data-collector-capacitor-plugin

 
 

Repository files navigation

dl-data-collector-capacitor-plugin

DLocal's Data Collector SDK capacitor plugin for ionic

This plugin is a wrapper of the native SDKs which can be found here:

More info about the functionallity of the SDK on each platform can be found on those repositories.

Install

As a dependency:

  • Add the following dependency to the package.json:
{

    "dependencies": {
        ...
        "dl-data-collector-capacitor-plugin": "https://bitbucket.org/dlocal-public/dlocal-data-collector-capacitor-plugin.git#v0.0.1"
        ...
    }
    
}
  • Run the following commands:
npm install

npx cap sync

Manual

  • Run the following commands:
npm install https://bitbucket.org/dlocal-public/dlocal-data-collector-capacitor-plugin.git#v0.0.1

npx cap sync

Usage

Setup on app start

Add this to your app startup,

    import { DataCollectorSDK, DLEnvironment } from 'dl-data-collector-capacitor-plugin';


    DataCollectorSDK.setUp({
      apiKey: "TEST",
      env: DLEnvironment.production
    });

    DatacollectorSDK.startSession();
    

Replacing apiKey with your key.

Link the session to the transaction

When the user starts the checkout transaction, gather the session id like so:

    import { DataCollectorSDK } from 'dl-data-collector-capacitor-plugin';

    var sessionId = (await DataCollectorSDK.getSession()).sessionId;

Submit this value in the payment request within the additional_risk_data.device.event_uuid parameter. The sessionId can be undefined if a session is not available or an error occurred.

Sample App:

Please check out the Sample App (at SampleApp/) to see a practical example.

API

setUp(...)

setUp(options: { apiKey: string; env: DLEnvironment; }) => Promise<void>
Param Type
options { apiKey: string; env: DLEnvironment; }

setUp(...)

setUp(options: { apiKey: string; }) => Promise<void>
Param Type
options { apiKey: string; }

startSession()

startSession() => Promise<void>

getSession()

getSession() => Promise<{ sessionId: string; }>

Returns: Promise<{ sessionId: string; }>


Enums

DLEnvironment

Members Value
production 0
sandbox 1

Packages

No packages published

Languages

  • TypeScript 41.4%
  • CSS 20.1%
  • Swift 15.8%
  • Java 11.6%
  • Ruby 5.2%
  • HTML 2.5%
  • Other 3.4%