1.1.31 • Published 6 months ago

@traund/sdk v1.1.31

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

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: 'test@customer.com',
                firstName: 'Test',
                lastName: 'Customer',
                identificationCountry: 'PE',
                identificationType: 'ID_CARD',
                identificationNumber: '44444444',
                phonePrefix: '+1',
                phoneNumber: '987654321',
            },
            receiver: {
                email: "location@merchant.com",
            },
            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.

    NameTypeDetail
    emailstringRequired.
    firstNamestringRequired.
    lastNamestringRequired.
    identificationCountrystringRequired. Country Codes Alpha-2
    identificationTypestringRequired. Possible values: ID_CARD-ID_BUSINESS-PASSPORT-RESIDENCE_PERMIT
    identificationNumberstringRequired.
    phonePrefixstringRequired.
    phoneNumberstringRequired.

    receiver => Receiver data, required if sdkMode is DIRECT_PAY.

    NameTypeDetail
    emailstringRequired.

    request_data => Required transaction data.

    NameTypeDetail
    storeIdstringOptional. Identifier of the calculated amount of the transfer to be made. This is obtained by invoking the calculation endpoint.
    amountnumberRequired.
    countrystringRequired. Country Code Alpha-2.
    currencystringRequired. Currency Code
    appliedFeebooleanrequired 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": "jesus@traund.com",
                "status": "registered", 
                "kyc": {
                    "required": true,
                    "status": "unregistered"
                }
            }
        }
    }

Response description:

  • success : Operation result flag.
  • message : Operation result description.
  • data : Result object.

    transaction => Transaction data.

    NameTypeDetail
    idstringTraund ID
    statusCodenumberStatus code
    statusNamestringStatus description
    currencystringReceiver currency
    amountnumberReceiver amount
    createdAtdateCreated date

    user => User data.

    NameTypeDetail
    emailstringTraund ID
    statusstringUser status
    kyc.requiredbooleanrequired compliance validation flag.
    kyc.statusstringCompliance 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.required field, 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.

Integration Example (In construction)

1. Authorize SDK with your credentials.

2. Calculate amount to transfer.

3. Create TraundApp instance.

3. Evaluate callback response.

1.1.29

8 months ago

1.1.28

8 months ago

1.1.30

8 months ago

1.1.31

6 months ago

1.1.27

9 months ago

1.1.26

9 months ago

1.1.25

9 months ago

1.1.22

11 months ago

1.1.21

11 months ago

1.1.20

11 months ago

1.1.16

11 months ago

1.1.15

11 months ago

1.1.19

11 months ago

1.1.18

11 months ago

1.1.17

11 months ago

1.1.12

11 months ago

1.1.11

12 months ago

1.1.10

12 months ago

1.1.14

11 months ago

1.1.13

11 months ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.1.2

1 year ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago