Skip to content

Latest commit

 

History

History
78 lines (62 loc) · 1.15 KB

README.md

File metadata and controls

78 lines (62 loc) · 1.15 KB

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);