# ecommpay

> Ecommpay Javascript package

Latest version **0.1.7** (published 2020-04-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install ecommpay
pnpm add ecommpay
yarn add ecommpay
bun add ecommpay
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.1.7 |
| Published | 2020-04-20 |
| First published | 2018-07-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Zhukov Roman |
| Maintainers | zhukovra |

## Links

- npm: https://www.npmjs.com/package/ecommpay
- Repository: https://github.com/ITECOMMPAY/paymentpage-sdk-js
- Homepage: https://github.com/ITECOMMPAY/paymentpage-sdk-js#readme
- Issues: https://github.com/ITECOMMPAY/paymentpage-sdk-js/issues
- npm.io page: https://npm.io/package/ecommpay

## Recent versions

- 0.1.7 (latest) — 2020-04-20
- 0.1.6 — 2020-04-17
- 0.1.5-1 — 2020-02-14
- 0.1.4 — 2019-11-14
- 0.1.3 — 2019-08-06
- 0.1.2 — 2018-12-07
- 0.1.1 — 2018-12-03
- 0.1.0 — 2018-07-05

## README

# EcommPay Javascript package

[![Build Status](https://travis-ci.org/ITECOMMPAY/paymentpage-sdk-js.svg?branch=master)](https://travis-ci.org/ITECOMMPAY/paymentpage-sdk-js)
[![Test Coverage](https://api.codeclimate.com/v1/badges/f92c4b71c7ebacfa2a32/test_coverage)](https://codeclimate.com/github/ITECOMMPAY/paymentpage-sdk-js/test_coverage)
[![Maintainability](https://api.codeclimate.com/v1/badges/f92c4b71c7ebacfa2a32/maintainability)](https://codeclimate.com/github/ITECOMMPAY/paymentpage-sdk-js/maintainability)

### What is it?

It is package that will help you with generating payment URL according to 
[EcommPay documentation](https://developers.ecommpay.com/en/en_PP_Integration.html).

### How to use?

#### Get payment page URL

1. Install the package (with your package manager):
```shell
npm install ecommpay
yarn add ecommpay
```

2. Require somewhere in your code, set parameters and get the URL:
```javascript
const { Payment } = require('ecommpay');

// create ECP object with your account ID and secret salt
const e = new Payment('112', 'my_secret');

// set payment details 
e.paymentAmount = 1000;
e.paymentId = 'FFCD12-30';
e.paymentCurrency = 'USD';

// set another parameters, like success or fail callback URL, customer details, etc.

// get payment URL
const url = e.getUrl();
```

Now your can render payment `url` somewhere on your checkout page.

#### Receive callback from Ecommpay

Example with [Express](http://expressjs.com):
```javascript
const { Callback } = require('ecommpay');

app.post('/payment/callback', function(req, res) {
  const callback = new Callback('secret', req.body);
  if (callback.isPaymentSuccess()) {
    const paymentId = callback.getPaymentId();
    // here is your code for success payment
  }
});
```
Note that `Callback` constructor throws Error if signature isn't valid.

---
_Source: https://npm.io/package/ecommpay · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
