3.0.1 • Published 3 years ago

zarinpal-typescript v3.0.1

Weekly downloads
53
License
MIT
Repository
github
Last release
3 years ago

Simple Zarinpal package written in TypeScript.

Installation

# Using npm
npm i zarinpal-typescript

# Using yarn
yarn add zarinpal-typescript

Configuration

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

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

const amount = 1000;
const authority = "previously-created-authority";

const verifiedPayment = await zp.verifyPayment({ amount, authority });
3.0.1

3 years ago

3.0.0

3 years ago

2.1.4

3 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago