webpay-purejs
v1.0.0
Published
WebPay Plus implementation in Node.js using ursa-purejs based on: https://github.com/sapienman/webpay-nodejs
Downloads
5
Readme
#webpay-nodejs
Módulo no oficial para integrar WebPay Plus en Node.js, con soporte para promesas.
Esta implementación está basada en el paquete creado por Rodrigo González.
Usa módulo ursa-purejs.
#Instalación
npm install webpay-purejs --save
#Transacción normal
La explicación detallada de los ejemplos de código está en /tests
- Instanciar
const WebPay = require('webpay-nodejs');
let wp = new WebPay({
commerceCode: youCommerceCode,
publicKey: youPublicKey,
privateKey: youPrivateKey,
webpayKey: youWebpayKey,
env: WebPay.ENV.INTEGRACION
});
- 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);
})
- Obtener datos de la transacción
wp.getTransactionResult(token).then((transaccion) => {
// datos de la transaccion
})
- Aceptar la transacción
wp.acknowledgeTransaction(token)
Opcionalmente; Anular
wp.nullify({
authorizationCode: '123',
authorizedAmount: 2000,
buyOrder: buyOrder
})
#Legalidades
Esta implementación está basada en el paquete creado por Rodrigo González
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.