1.0.27 • Published 4 years ago

@singleware/payzen v1.0.27

Weekly downloads
7
License
MIT
Repository
github
Last release
4 years ago

PayZen

Rest client for the PayZen gateway, for more info, please check the Official Documentation

Usage

Authorizing the connection.

import * as PayZen from '@singleware/payzen';
import * as Injection from '@singleware/injection';

// Basic authorization.
Injection.resolve(PayZen.Client).setAuthorization('USER', 'SECRET');

Creating new credit card token.

import * as PayZen from '@singleware/payzen';
import * as Injection from '@singleware/injection';

// Getting a promise to receive the credit card token.
const promise = Injection.resolve(PayZen.Tokens.Mapper).create({
  currency: PayZen.Types.Currency.BRL,
  customer: {
    email: 'customer@email.br'
  },
  paymentForms: [
    {
      paymentMethodType: PayZen.Types.Payment.Method.Card,
      pan: 'CARD_NUMBER',
      expiryMonth: 'CARD_MONTH',
      expiryYear: 'CARD_YEAR',
      securityCode: 'CARD_CVV'
    }
  ]
});

Creating a new payment based on the received card token.

import * as PayZen from '@singleware/payzen';
import * as Injection from '@singleware/injection';

// Getting a promise to receive the payment uuid.
const promise = Injection.resolve(PayZen.Payments.Mapper).create({
  amount: 1000,
  currency: PayZen.Types.Currency.BRL,
  paymentMethodToken: 'CARD_TOKEN',
  customer: {
    email: 'customer@email.br'
  }
});

Creating a new subscription based on the received card token.

import * as PayZen from '@singleware/payzen';
import * as Injection from '@singleware/injection';

// Getting a promise to receive the subscription id.
const promise = Injection.resolve(PayZen.Payments.Mapper).create({
  amount: 1000,
  currency: PayZen.Types.Currency.BRL,
  effectDate: new Date(),
  paymentMethodToken: 'CARD_TOKEN',
  rrule: 'RRULE:FREQ=MONTHLY;BYMONTHDAY=1;COUNT=1',
  customer: {
    email: 'customer@email.br'
  }
});

Install

Using npm:

npm i @singleware/payzen

License

MIT © Silas B. Domingos

1.0.27

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.11

4 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago