2.3.0 โ€ข Published 9 months ago

@migopayments/sdk v2.3.0

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

๐Ÿงฐ Prerequisites

  • Install node.js in your environment
  • Access to merchant and privateKey credentials provided by MigoPayments.

๐Ÿ“ฆ Installation

$ npm install @migopayments/sdk

๐Ÿš€ Initial Configuration

Initialize the SDK with credentials provided by MigoPayments and set up the environment you wish to work in.

import { loadMigo } from "@migopayments/sdk";

const initSdk = async () => {
    const migo = await loadMigo({
        merchant: "merchant_id", // provided by Migo
        privateKey: "private_key", // provided by Migo
        environment: "sandbox",
    });

    // Use `migo` for your transactions
};

initSdk();
EnvironmentDescription
sandboxUse this to build and test your application ๐Ÿงช.
productionUse this for production.

The migo object will expose the multiple methods available in the SDK.

๐Ÿงฉ The schema object

The schema object serves a crucial purpose in the SDK by dynamically validating payload information sent by the client. It is custom-tailored to each client, providing a unique framework for organizing and structuring data. By printing it to the console, you can gain valuable insight into how the SDK handles and enforces data validations, making it an indispensable tool for developers.

// print out the schema
console.log(JSON.stringify(migo.schema));

The structure of the config comes in an array, because you can have multiple clients or different branches. So the basic structure is this:

[
  {
    clients: [ { key: 'migoTest', name: 'Migo Test' }]
    processors: [
      {
        processor: 'processor1', // This is the key to send in some payloads
        processorName: 'Processor 1', // Friendly name of the processor,
        cards: true, // Flag to know if you can save cards
        installments: [1,2,3...], // How many installments it can handle,
        inputsMakePayment: [ // Super important part, to know how to create a payload to send when making a payment
          {
           //.....
          },
          {
           //.....
          },
        ],
        ...
      }
    ]
  },
  {
    //...
  }
]

BUT in most cases, you will have just one client. So the array will come with one object. Please always make sure to print the migo.schema to check that you have assigned your client and the processor keys. If not please contact migo support to validate your credentials.

Tips for Implementing the SDK in Your Frontend

  • Data Validation: It's important to validate the data being inputted. Specifically, the amount field should not accept text.

    • Suggestion: Consider disabling the 'create transaction' button or turning it gray when the mandatory fields are not populated.
  • Input Validation: Inputs should be validated based on the type of data they are expected to contain, such as text or numbers.

  • Security Enhancement: For security purposes, do not use console.log specially in data like the merchant's credentials and privateKey.

  • Handling customKeys: When sending customKeys, if there's no error or feedback displayed, it can be confusing for the user.

  • Field Validation: There should be validation checks on input fields based on the required data type.

  • Handling Non-Existent Tokenized Card Transactions: If a search for a tokenized card transaction yields no results, a message indicating that no transaction was found should be displayed.

๐Ÿ“š More information

SDK Full Documentation

MigoPayments

2.3.0

9 months ago

2.2.38

9 months ago

2.2.37

9 months ago

2.2.17

10 months ago

2.2.1

1 year ago

2.2.18

10 months ago

2.2.0

1 year ago

2.2.15

10 months ago

2.2.3

12 months ago

2.2.16

10 months ago

2.2.2

1 year ago

2.2.13

10 months ago

2.2.5

12 months ago

2.2.14

10 months ago

2.2.4

12 months ago

2.2.11

11 months ago

2.2.7

12 months ago

2.2.12

11 months ago

2.2.6

12 months ago

2.2.10

11 months ago

2.1.9

1 year ago

2.2.19

10 months ago

2.2.28

9 months ago

2.2.29

9 months ago

2.2.26

9 months ago

2.2.27

9 months ago

2.2.24

9 months ago

2.2.25

9 months ago

2.2.22

10 months ago

2.1.10

1 year ago

2.2.23

10 months ago

2.2.20

10 months ago

2.2.21

10 months ago

2.1.2

1 year ago

2.1.4

1 year ago

2.1.3

1 year ago

2.2.35

9 months ago

2.1.6

1 year ago

2.2.36

9 months ago

2.1.5

1 year ago

2.2.33

9 months ago

2.1.8

1 year ago

2.2.34

9 months ago

2.1.7

1 year ago

2.2.31

9 months ago

2.2.32

9 months ago

2.2.30

9 months ago

2.2.9

11 months ago

2.2.8

11 months ago

1.0.9

2 years ago

2.0.3

2 years ago

2.1.1

2 years ago

2.0.4

2 years ago

1.0.10

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago