# festpay

> festpay Javascript package

Latest version **0.1.7** (published 2022-12-19) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.7 |
| Published | 2022-12-19 |
| First published | 2022-12-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | festpay |

## Links

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

## Recent versions

- 0.1.7 (latest) — 2022-12-19

## README

# festpay Javascript package

[![Build Status](https://travis-ci.com/festpay/paymentpage-sdk-js.svg?branch=main)](https://travis-ci.com/festpay/paymentpage-sdk-js)

### What is it?

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

### How to use?

#### Get payment page URL

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

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

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

// set payment details 
e.paymentAmount = 1000;
e.paymentId = 'F1212-30';
e.paymentCurrency = 'RUB';

// 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 festpay

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

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/festpay · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
