Giter VIP home page Giter VIP logo

flow's Introduction

Flow Meteor

Flow es una plataforma de pagos que te permite realizar pagos vía webpay.

Instrucciones

meteor add nicolaslopezj:flow

Obtener key

Para obtener la key debes entrar a https://www.flow.cl/app/web/misDatos.php y hacer click en el boton descargar certificado.

Para el ambiente de pruebas debes entrar a http://flow.tuxpan.com/app/web/misDatos.php y hacer click en el boton descargar certificado.

Configurar

import {setConfig} from 'meteor/nicolaslopezj:flow';

setConfig({
  baseUrl: 'http://myapp.com/',
  successUrl: 'http://myapp.com/success',
  failureUrl: 'http://myapp.com/failure',
  key: Assets.getText('comercio.pem'),
  publicKey: Assets.getText('flow.pubkey'),
  email: '[email protected]',
  confirm: myConfirmFunction,
  paymentTypes: 1,
});
  • baseUrl: La url del sitio web. Se necesita para que flow confirme el pago. En caso de estar en ambiente local, hay abrir los puertos desde el router y poner la ip publica. Ej: http://190.161.223.246:3000.

  • successUrl: Url donde va a llegar el usuario cuando el pago se realice correctamente.

  • failureUrl: Url donde va a llegar el usuario cuando el pago tenga algun error.

  • key: La privada llave que entrega flow a cada comercio. Si la guardas en la carpeta private de la app puedes usar Assets.getText('comercio.pem') para obtenerla.

  • publicKey: La privada publica de Flow.

-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAx0BVTE0HmmtEDfKydMLF
YrfRsQPY6B8fYeNtl76GHLZyhSl3+MzYKdic9oJbvDm2Co9x6zNgUEzEA1RmjZ9H
yVS5mJEj0VRM2Ydx2kfG33bjmwsWSoasPNnCeIvApYZWRVsKICIVrH5wUqky3Jku
4grLynflGO0rYYC+mOcqbr+9/tJ/bDX0fFcNFHNz1xRcca32A/jZXd2N4W80vPrD
uUqy5uqaQEIX65EP1y/wmNaM6nK8WprgkX1Qi5xeN7ikaDEROiYLbZedz+FxqBOL
nvETvFAmDWFjQeb0+ppDoA3dZPW7oebnyLALGSJVmia+Ig3OsKFmf6F67ygN+4R/
gJESLyS92kvGpbJGSc130FKt2wmLhO0YmFNzNF4s01hHgigVuVG6OqNdYCtvNbQH
tIcBnUOUyma3Z0zKAH3lPW4nOljM9uNihG32UNlGeV9d/UmjqvVvLy5MbeEEsEw2
LqXH9cGZVjDxt+Qq5y2Mw2/v0E9v+7CyTkUxhU6iY0xXSpajFnoIAQpCY/NhPGQu
N9cFJxGY1EB7cVp8nZzZIWo7u9lsoEDqG93ugmqA/mFSsevn0qUTJinSbbxjiXyo
1hU4TLtGY9myYeljO5uoLn1Kps5950U/tilNh8LJALwVniJuO+E+CeQgLuD/lNAv
vlOeisrct5CChy8/+tfL5fcCAwEAAQ==
-----END PUBLIC KEY-----
  • email: El email de la cuenta de flow.

  • confirm: Una función que se llamará para que la aplicación verifique que el pago esta correcto. Debe retornar true para que el pago se apruebe, si retorna un string, este sera el mensaje de error.

  • paymentTypes: Ingrese aquí el medio de pago, Solo Webpay = 1, Solo Servipag = 2, Todos los medios de pago = 9;

Crear nuevos pagos

https://github.com/nicolaslopezj/flow/tree/master/client/home

import {newOrder} from 'meteor/nicolaslopezj:flow';

Meteor.methods({
  createOrder: function ({ amount, description, buyerEmail }) {
    const order = newOrder({
      amount,
      description,
      buyerEmail,
      paymentType: 1,
      successUrl: 'success',
      failureUrl: 'failure',
      meta: {
        productId: 'myProductId',
      },
    });

    console.log('New payment generated', order.paymentId);
    return order.pack;
  },
});

Confirmar pagos

/**
 * El monto ya fue verificado al llamar esta funcion
 */
export default confirm = function (payment) {
  console.log('confirming payment', payment);

  // payment.meta.paymentId

  //return 'No products lefts';
  return true;
};

Ejemplo

Este proyecto esta dentro de una aplicacion meteor que puedes usar para probar.

flow's People

Contributors

nicolaslopezj avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.