Skip to content

5h1rU/epayco-tokenizer

Repository files navigation

epayco-tokenizer

installation

npm install epayco-tokenizer

How to use

As a Promise

import Tokenizer from "epayco-tokenizer";

const tokenizer = new Tokenizer(<EPAYCO_PUBLIC_TOKEN>);

const payload = [
    {
      type: "name",
      value: "Fulano de tal"
    },
    {
      type: "email",
      value: "[email protected]"
    },
    {
      type: "number",
      value: "4575623182290326"
    },
    {
      type: "cvc",
      value: "123"
    },
    {
      type: "date_exp",
      value: "07" + "/" + "2017",
      required: !0
    }
  ];

const response = tokenizer.init(payload).then(response => ...));

or with async/await syntax

import Tokenizer from "epayco-tokenizer";

const tokenizer = new Tokenizer(<EPAYCO_PUBLIC_TOKEN>);

const payload = [
    {
      type: "name",
      value: "Fulano de tal"
    },
    {
      type: "email",
      value: "[email protected]"
    },
    {
      type: "number",
      value: "4575623182290326"
    },
    {
      type: "cvc",
      value: "123"
    },
    {
      type: "date_exp",
      value: "07" + "/" + "2017",
      required: !0
    }
  ];

const response = await tokenizer.init(payload);