Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@chuva.io/sisp

Package Overview
Dependencies
Maintainers
5
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chuva.io/sisp

This module simplifies getting started with processing Vinti4, Visa, and Mastercard payments using SISP on Node.js.

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

SISP PAYMENTS JS

Introduction

This module simplifies getting started with processing Vinti4, Visa, and Mastercard payments using SISP on Node.js.

Note: You can request SISP credentials, view their documentation, and more here.

// Credentials that should be provided by SISP
const posID = "";
const posAutCode = "";
const url = "";

These credentials are used to allow you to process the payment using SISP payment services.

Getting Started

Quick Overview

You can install this package using npm or yarn by running one of the following commands:

$ npm install @chuva.io/sisp
# OR
$ yarn add @chuva.io/sisp

Module Configuration

Import sisp-payments and create a new instance using your credentials. (obtained from SISP):

const Sisp = require('sisp-payments');

const posID = 900512;
const posAutCode = "123456789ssA";
const url = "https://mc.vinti4net.cv/payments";

const sisp = new Sisp({ posID, posAutCode, url });

Generate Payment Request Form

sisp.generatePaymentRequestForm(referenceId, total, webhookUrl);

Generates and returns an HTML form that can be used to process payments.

  • referenceId: Client-generated payment reference ID. This value is sent via a POST request to the webhookUrl and allows the client to correlate the payment request and response.
  • total: Payment amount (in CVE).
  • webhookUrl: The url where SISP should send the payment response. You should expect a POST request with payment information in the body. See the SISP documentation for more information.

Example

const referenceId = 'abc-123';
const total = 1200;
const webhookUrl = 'https://samba.chuva.io/webhooks/sisp-payment';

const htmlForm = sisp.generatePaymentRequestForm(referenceId, total, webhookUrl);

Validate Payment Processing Status (convenience method)

Check whether or not a payment was processed successfully. Note: This method is provided as a convenience. See the SISP documentation for the request structure.

Usage

Pass the Webhook request body to validatePayment. Returns an error object containing code and description if there is an error, otherwise returns undefined.

validatePayment(responseBody)

Note: The responseBody should be of type x-www-form-urlencoded as provided by SISP.

Possible Errors
Code: stringDescription: string
001Payment processing error: Invalid fingerprint
002Payment processing error: Cancelled by user
003Payment processing error: Processing error

Example

 app.post("/webhook-handler", (request, response) => {
     const error = sisp.validatePayment(request.body);

     if(error === undefined) {
         // Payment processed successfully
     }
     else {
         // Payment processing error
         console.log(error.code);
         console.log(error.description);
     }
 }

Keywords

FAQs

Package last updated on 21 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc