Skip to content

[Spanish/Chile] Módulo no oficial para integrar WebPay Plus en Node.js, con soporte para promesas.

Notifications You must be signed in to change notification settings

p3140/webpay-nodejs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#webpay-nodejs

Módulo no oficial para integrar WebPay Plus en Node.js, con soporte para promesas.

#Instalación

npm install webpay-nodejs --save

#Transacción normal

La explicación detallada de los ejemplos de código está en /tests

  1. Instanciar
const WebPay = require('webpay-nodejs');

let wp = new WebPay({
    commerceCode: youCommerceCode,
    publicKey: youPublicKey,
    privateKey: youPrivateKey,
    webpayKey: youWebpayKey,
    env: WebPay.ENV.INTEGRACION
});
  1. Iniciar Transacción
wp.initTransaction({
    buyOrder: buyOrden,
    sessionId: req.sessionId,
    returnURL: url + '/verificar',
    finalURL: url + '/comprobante',
    amount: amount
}).then((data) => {
    res.redirect(data.url + '?token_ws=' + data.token);
})
  1. Obtener datos de la transacción
wp.getTransactionResult(token).then((transaccion) => {
    // datos de la transaccion
})
  1. Aceptar la transacción
wp.acknowledgeTransaction(token)

Opcionalmente; Anular

wp.nullify({
authorizationCode: '123',
authorizedAmount: 2000,
buyOrder: buyOrder
})

#Breaking Changes v1.0.0

  • getTransactionResult retornaba transaction.detailOutput como un array con un único objeto las propiedades, ahora transaction.detailOutput retorna directamente dicho objeto.

    • Ejemplo antes: transaction.detailOutput[0].amount
    • Ejemplo ahora: transaction.detailOutput.amount

#Legalidades

La verificación del certificado único y especial de WebPay fue gracias a (FabianBravoA)[https://github.com/FabianBravoA/tbk_node].

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Licencia LGPL.

About

[Spanish/Chile] Módulo no oficial para integrar WebPay Plus en Node.js, con soporte para promesas.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%