1.1.0 • Published 2 years ago

node-paytr v1.1.0

Weekly downloads
9
License
ISC
Repository
github
Last release
2 years ago

node-paytr

It's not an official package of PayTR.

This package provides to get an iframe token for your payment gateway and receive the POST requests from PayTR to your callback URL.

Install

npm install node-paytr

Pseudo-code

import PayTR from 'node-paytr';
import express from 'express';

const app = express();
app.use(express.json())

const paytr = new PayTR(merchant_params);

app.post('/get_token', (req, res) => {
    const user_params = req.body;
    res.send(paytr.getToken(user_params));
})

app.post('/callback', (req, res) => {
  paytr.getPost(req.body, ({merchant_oid, status}) => {
    // do your db lookups and updates here
  });
  res.send("OK"); // this line notifies PayTR that you got the callback data
})

Parameters

Take a look to the official PayTR docs to get more details about parameters and type declarations.

Mercanttype
merchant_idstring
merchant_keystring
merchant_saltstring
debug_on1 or 0 as number
no_installment1 or 0 as number
max_installmentnumber
timeout_limitnumber
test_mode1 or 0 as number
langstring
Transactiontype
user_ipstring
user_namestring
user_addressstring
user_phonestring
payment_amountinteger
user_basketarray
emailstring
merchant_oidstring
currencystring
merchant_ok_urlstring
merchant_fail_urlstring
POST Callback Datatype
bodyobject
callbackfunction
1.1.0

2 years ago

1.0.91

2 years ago

1.0.9

2 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 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