@traund/sdk
v1.1.32
Published
Traund SDK
Readme
Traund SKD
A javascript library to facilitate the use of the money transfer framework in Traund.
It is intended for usage in browsers.
Installation
The library is UMD compatible, you can download [sdk.bundle.js] and host it at your site or use a CDN such as Unpkg CDN :
<script src="https://unpkg.com/@traund/sdk/build/sdk.bundle.js"></script>How to use
This library allows you to make money transfers (send or receive) through the Traund platform. To use it you need the integration credentials that are sent to the partner merchant.
Receive payments
You can use this example to start receiving payments using the Traund SDK.
// Initialize client with name of your database and PUBLIC token
const app = new TraundApp();
//Interactions take Id of user and Id of item
app.init(
params :{
token: 'merchant-token',
paymentMethods: ['TRANSFER'],
storeId: ,
sdkMode: 'REGULAR_PAY',
language: 'en',
theme: 'light',
isSandbox: true,
metadata: {
sender: {
email: '[email protected]',
firstName: 'Test',
lastName: 'Customer',
identificationCountry: 'PE',
identificationType: 'ID_CARD',
identificationNumber: '44444444',
phonePrefix: '+1',
phoneNumber: '987654321',
},
receiver: {
email: "[email protected]",
},
split:[]
},
request_data: {
storeId: 'transaction-calculate-id',
amount: 100,
country: "US",
currency: "USD",
appliedFee: true
},
},
callback,
callbackArgs : [callbackParam1, callbackParam2, callbackParam3]
);
You can follow the recommendations in the Traund documentation, the parameters needed to initialize the component are detailed below.
token: Token generated with the authorization credentials you provide to the partner merchant. This is obtained by invoking the authorizate endpoint.paymentMethods: SDK metadata that enable one of two options to make the payment possible. Possible values: ['TRANSFER'|'CARD']sdkMode: usage mode, indicates whether the client will send user's information to traund SDK.Possible values:[REGULAR_PAY|DIRECT_PAY].
REGULAR_PAY => means a normal Traund's transference, and where the payer metadata is not mandatory and can be filled in the process.
DIRECT_PAY => means using traund as a direct payment method. Where the payer's data is mandatory and there is no step during the process where they will be filled out.
language: Possible values: [en|es].theme: Possible values: [light|dark].isSandbox: It's optional. It should only be sent with the value "true", when testing in the sandbox environment.metadata: Data required for SDK invocation.sender => Payer data, required if sdkMode is DIRECT_PAY.
| Name | Type | Detail | | ------ | ------ |------------ | |
email| string | Required.| |firstName| string | Required.| |lastName| string | Required.| |identificationCountry| string | Required. Country Codes Alpha-2| |identificationType| string | Required. Possible values: ID_CARD-ID_BUSINESS-PASSPORT-RESIDENCE_PERMIT| |identificationNumber| string | Required.| |phonePrefix| string | Required.| |phoneNumber| string | Required.|receiver => Receiver data, required if sdkMode is DIRECT_PAY.
| Name | Type | Detail | | ------ | ------ |------------ | |
email| string | Required.|request_data => Required transaction data.
| Name | Type | Detail | | ------ | ------ |------------ | |
storeId| string | Optional. Identifier of the calculated amount of the transfer to be made. This is obtained by invoking the calculation endpoint.| |amount| number | Required.| |country| string | Required. Country Code Alpha-2.| |currency| string | Required. Currency Code| |appliedFee| boolean | required if paymentMethods include CARD|
Callback
The use of a callback function is required. This must receive as first parameter a "response" object, here the result of the operation performed through the SDK will be returned.
Additional parameters can be sent through the array "callbackArgs", which will be sent to the callback with the object "response".
function customCallback(response, callbackParam1) {
console.log(response, param);
}
var callbackParam1 = "Thanks for using Traund SDK";
app.init(params , customCallback, callbackArgs : [callbackParam1, callbackParam2, callbackParam3]);Response Object
It is the first parameter defined in the "callback" function where the result of the operation is sent.
For example:
//Interactions take Id of user and Id of item
{
"success": true,
"message": "Transaction successfully updated",
"data": {
"transaction": {
"id": "63186a7ec8437ae8c46658a7",
"statusCode": 200,
"statusName": "Deposited",
"currency": "USD",
"amount": 100.00,
"createdAt": "2022-09-07T09:55:10.112Z"
},
"user": {
"email": "[email protected]",
"status": "registered",
"kyc": {
"required": true,
"status": "unregistered"
}
}
}
}
Response description:
success: Operation result flag.message: Operation result description.data: Result object.transaction => Transaction data.
| Name | Type | Detail | | ------ | ------ |------------ | |
id| string | Traund ID| |statusCode| number | Status code| |statusName| string | Status description| |currency| string | Receiver currency | |amount| number | Receiver amount| |createdAt| date | Created date|user => User data.
| Name | Type | Detail | | ------ | ------ |------------ | |
email| string | Traund ID| |status| string | User status| |kyc.required| boolean | required compliance validation flag.| |kyc.status| string | Compliance Status.|KYC Validation
All persons performing transactions using the Traund payment button through the SDK must undergo a mandatory identity validation process.
SDK response will return the result of this validation in the
data.user.kyc.requiredfield, indicating whether the person is required to undergo the process.It is the responsibility of each customer to ensure that the person making the payment has undergone a KYC process; if this process cannot be validated, the transaction will not be completed.
In addition, it is possible to use our compliance services to meet the identity validation requirement, please contact your dedicated sales advisor for more information.
