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.
- 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
- Run the following commands:
npm install https://bitbucket.org/dlocal-public/dlocal-data-collector-capacitor-plugin.git#v0.0.1
npx cap sync
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.
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.
Please check out the Sample App (at SampleApp/) to see a practical example.
setUp(options: { apiKey: string; env: DLEnvironment; }) => Promise<void>
Param | Type |
---|---|
options |
{ apiKey: string; env: DLEnvironment; } |
setUp(options: { apiKey: string; }) => Promise<void>
Param | Type |
---|---|
options |
{ apiKey: string; } |
startSession() => Promise<void>
getSession() => Promise<{ sessionId: string; }>
Returns: Promise<{ sessionId: string; }>
Members | Value |
---|---|
production |
0 |
sandbox |
1 |