netpayjs-reactjs

1.0.17 • Public • Published

netpayjs-reactjs

Libreria desarrollada en el framework de ReactJS basado en la herramienta de netpay js (Custom Checkout)

NPM JavaScript Style Guide

Install

npm install --save netpayjs-reactjs

Build for local testing

In the root of the project

npm install

npm start

In the example folder

npm install

npm start

En caso de error al usar React con Typescript, agregar un archivo llamado 'alltypes.d.ts' y agregar la libreria de la siguiente forma 'declare module 'netpayjs-reactjs'.

Usage

import React from 'react'
import NetPay from 'netpayjs-reactjs'

function success(e) {
  console.log("Token created successfully");
  console.log(e); 
}

function error(e) {
  console.log("Something went wrong!");
  console.log(e);
}

/*
  sandboxmode = false -> Apunta a ambiente productivo
  sandboxmode = true -> Apunta a ambiente de pruebas

  showform = true -> Muestra formulario de tarjeta
  showform = false -> No muestra formulario de tarjeta
*/
const form = {
  id: 'netpay-form',
  success,
  error,
  options: { title: "Pagos con tarjeta", submitText: "Continuar" },
  sandboxMode: {boolean},
  showForm: true
}

const noForm = {
  success,
  error,
  cardInformation: {
      cardNumber: {Tarjeta},
      expMonth: {MesExp},
      expYear: {AñoExp},
      cvv2: {CVV},
      deviceFingerPrint: ''
  },
  sandboxMode: {boolean},
  showForm: false
}

const App = () => {
  let netpayDiv = document.createElement('div')
  netpayDiv.id = 'netpay-form'
  document.body.appendChild(netpayDiv)
  return (
    <NetPay apikey="apikey" form={form} />
  )
}

Package Sidebar

Install

npm i netpayjs-reactjs

Homepage

netpay.mx

Weekly Downloads

2

Version

1.0.17

License

MIT

Unpacked Size

135 kB

Total Files

7

Last publish

Collaborators

  • netpaymx