# zarinpal-typescript

> Simple Zarinpal package written in TypeScript.

Latest version **3.0.1** (published 2021-06-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install zarinpal-typescript
pnpm add zarinpal-typescript
yarn add zarinpal-typescript
bun add zarinpal-typescript
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2021-06-10 |
| First published | 2020-09-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 23.3 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Soroosh Merajiyan |
| Maintainers | sorooshmerajiyan |

## Links

- npm: https://www.npmjs.com/package/zarinpal-typescript
- Repository: https://github.com/SorooshMerajiyan/zarinpal-typescript
- Homepage: https://github.com/SorooshMerajiyan/zarinpal-typescript#readme
- Issues: https://github.com/SorooshMerajiyan/zarinpal-typescript/issues
- npm.io page: https://npm.io/package/zarinpal-typescript

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^0.21.1

## Recent versions

- 3.0.1 (latest) — 2021-06-10
- 3.0.0 — 2021-05-31
- 2.1.4 — 2021-03-21
- 2.0.4 — 2021-02-26
- 2.0.3 — 2021-01-20
- 2.0.2 — 2021-01-18
- 2.0.1 — 2020-09-29
- 2.0.0 — 2020-09-29
- 1.0.1 — 2020-09-05
- 1.0.0 — 2020-09-05

## README

Simple Zarinpal package written in TypeScript.

# Installation

```bash
# Using npm
npm i zarinpal-typescript

# Using yarn
yarn add zarinpal-typescript
```

## Configuration

```typescript
import { Zarinpal } from "zarinpal-typescript";

const zp = new Zarinpal("merchant-code", {
  /**
   * Sandbox is for development only
   * And should be turned off in production.
   */
  sandbox: true,
});
```

## Creating invoice

```typescript
// Create invoice
const createdPayment = await zp.requestPayment({
  amount: 1000, // Toman
  callbackUrl: "https://example.com/my-call-back-url?custom-param=value",
  description: "Invoice description", // This is required!
});

// Redirect user to the createdPayment.url
```

## Verifying the payment (callback)

```typescript
const amount = 1000;
const authority = "previously-created-authority";

const verifiedPayment = await zp.verifyPayment({ amount, authority });
```

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