netpayjs_reactnative
TypeScript icon, indicating that this package has built-in type declarations

0.1.9 • Public • Published

netpayjs_reactnative

Libreria desarrollada en el framework de React Native para dispositivos moviles, basado en la herramienta de netpay js (Custom checkout)

Instalacion de libreria

npm install netpayjs_reactnative

Levantar proyecto de manera local

yarn - Instala todas las dependencias
yarn example start - Levanta el proyecto del repositorio
expo start - Levantar proyecto creado desde cero

Implementación

import { NetPay } from 'netpayjs_reactnative';
import React from 'react';
import { Alert } from 'react-native';
import { View, StyleSheet } from 'react-native';

function success(e: any) {
  console.log('Token created successfully');
  Alert.alert('Token created successfully', 'El token se creo correctamente.');
  console.log(e);
}

function error(e: any) {
  console.log('Something went wrong!');
  Alert.alert('Something went wrong!', 'Ocurrio un error, intenta nuevamente.');
  console.log(e);
}

//Si se desea realizar pruebas en modo sandbox descomentar la propiedad sandboxMode: true, en caso contrario no agregarlo.

const form = {
  id: 'netpay-form',
  success,
  error,
  options: { title: 'Pagos con tarjeta', submitText: 'Continuar' },
  //sandboxMode: true,
};

const noForm = {
  success,
  error,
  cardInformation: {
    cardNumber: 'numberCard',
    expMonth: 'expMonth',
    expYear: 'expYear',
    cvv2: 'cvv',
    deviceFingerPrint: '',
    //sandboxMode: true,
  },
};

//SON ESTILOS PARA CENTRAR EL FORMULARIO DE PAGO
const styles = StyleSheet.create({
  container: {
    flex: 1,
    top: 80,
  },
});

// Usar api keys dependiendo al ambiente que apunten
// apikey="Usar public key"
// form={formulario declarados anteriormente}

export default function App() {
  return (
    <View style={styles.container}>
      <NetPay apikey="apiKey" form={"form o noForm"} />
    </View>
  );
}

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Package Sidebar

Install

npm i netpayjs_reactnative

Homepage

netpay.mx

Weekly Downloads

2

Version

0.1.9

License

MIT

Unpacked Size

112 kB

Total Files

10

Last publish

Collaborators

  • netpaymx