0.0.10 • Published 5 months ago

payture-official v0.0.10

Weekly downloads
6
License
MIT
Repository
github
Last release
5 months ago

NodeJS-Payture-official

This is Offical Payture API for NodeJS. To get started you will need a Merchant account, please contact our support to get one. Here you can explore how to use our API functions! GO!

Install

Simple to install:

npm install payture-official

And include to your project:

var payture = require('payture-official');

Payture API tutorial

You can use one or all of follows API:

General information

Callback function

Every API function received callback function as second parameter. You need to provide callback for taking required action after receiving a response from the server. The callback accepts 4 parameters:

var callbackFunc = function(error, response, body, responseObject){
    // do some work with received arguments....
};
  • error - if no one error occurs when handing request the value of this parameter will be null, otherwise - in case of error - the value is the error;
  • response - the raw response from the external server;
  • body - body of the received response;
  • responseObject - this is body of the response as js object;

API Initialization

For create instanse of required API you need provide the name of Host and params of your Merchant account (Key and Password).

HOST

Pass the 'https://sandbox.payture.com' for test as the name of Host (first parameter).

Merchant

Params of Merchant account provide as the second parameter for constructor function in simple object, like: { Key : 'YourMerchantAccount', Password : 'YourPassword' };

Please note, that { Key : 'YourMerchantAccount', Password : 'YourPassword' } - fake account, our support help you to get one! Examples you can see below.

Payture API

For use this you need create instanse of PaytureAPI object. Example:

var api = new payture.Api('https://sandbox.payture.com', { Key : 'YourMerchantAccount', Password : 'YourPassword' });

Please note, that { Key : 'YourMerchantAccount', Password : 'YourPassword' } - fake account, our support help you to get one!

API Functions:

All functions taking 2 parameters: first - required for request data as js object, second - callback function that you need specify. The functions list and examples of usage below. Let's go to explore!

pay

var data = {
    OrderId : 'ORD00000000000000001',
    Amount : 10000,
    PAN : '4111111111111112',
    EMonth : 12,
    EYear : 20,
    CardHolder : 'Vasya Petrov',
    SecureCode : 123,
    CustomerKey : 'testCustomer',
    CustomFields : {},
};
api.pay(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
OrderIdPayment identifier in your service system.
AmountAmount of payment kopec.
PANCard's number.
EMonthThe expiry month of card.
EYearThe expiry year of card.
CardHolderCard's holder name.
SecureCodeCVC2/CVV2.
CustomerKeyCustomer identifier in Payture AntiFraud system.
CustomFieldsAddition fields for processing (especially for AntiFraud system).

block

The data and description for params as the same as for pay function.

api.block(data, callbackFunc);

charge

var data = {
    OrderId : 'ORD00000000000000001',
    Amount : 10000
};
api.charge(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
OrderIdPayment identifier in your service system.
AmountAmount of payment kopec.

refund

The data and description for params as the same as for charge function.

api.refund(data, callbackFunc);

unblock

The data and description for params as the same as for charge function.

api.unblock(data, callbackFunc);

getState

var data = {
    Key : 'YourMerchantAccount',
    OrderId : 'ORD00000000000000001'
};
api.getState(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
KeyYourMerchantAccount
OrderIdPayment identifier in your service system.

Payture InPay

For use this API just create instanse of PaytureInPay object:

var inpay = new payture.InPay('https://sandbox.payture.com', { Key : 'YourMerchantAccount', Password : 'YourPassword' });

Please note, that { Key : 'YourMerchantAccount', Password : 'YourPassword' } - fake account, our support help you to get one!

API Functions:

init

var data = {
    OrderId : 'ORD00000000000000001',
    Amount : 10000,
    IP : '127.0.0.1',
    SessionType	 : 'Pay',
    Url : 'payture.com',
    TemplateTag : '',
    Language : 'RU',
    Total : 1,
    Product : 'Something'
};
inpay.init(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
OrderIdPayment identifier in your service system.
AmountAmount of payment kopec.
IPCustomer's IP.
SessionType'Pay' - for 1-stage payment, 'Block' - for 2-stage payment.
UrlThe url for return customer after completion of payment.
TemplateTagUsed template.
LanguageTemplate language.

pay

var sessionId = 'e5c43d9f-2646-42bc-aeec-0b9005ceb972'; //retrived from init response
inpay.pay(sessionId, callbackFunc);

Description of provided params.

Parameter's nameDefinition
sessionIdPayment identifier. Given by init response

charge

var data = {
    OrderId : 'ORD00000000000000001',
    Amount : 10000,
};
inpay.charge(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
OrderIdPayment identifier in your service system.
AmountAmount of payment kopec.

refund

The data and description for params as the same as for charge function.

api.refund(data, callbackFunc);

unblock

The data and description for params as the same as for charge function.

api.unblock(data, callbackFunc);

payStatus

var orderId : 'ORD00000000000000001';
inpay.payStatus(orderId, callbackFunc);

Description of provided params.

Parameter's nameDefinition
OrderIdPayment identifier in your service system.

Payture eWallet

For use this API just create instanse of PaytureEWallet object:

var ew = new payture.EWallet('https://sandbox.payture.com', { Key : 'YourMerchantAccount', Password : 'YourPassword' });

Please note, that { Key : 'YourMerchantAccount', Password : 'YourPassword' } - fake account, our support help you to get one!

API Functions:

Payment functions:

init
var data = {
    OrderId : 'ORD00000000000000001',
    Amount : 10000,
    IP : '127.0.0.1',
    SessionType	 : 'Pay',
    CardId : '40252318-de07-4853-b43d-4b67f2cd2077',
    VWUserLgn : '123@ya.ru',
    VWUserPsw : '2645363',
    PhoneNumber : '79001234567',
    TemplateTag : '',
    Language : 'RU',
};
ew.init(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
OrderIdPayment identifier in your service system.
AmountAmount of payment kopec.
IPCustomer's IP.
SessionType'Pay' - for 1-stage payment, 'Block' - for 2-stage payment, 'Add' - for register card.
VWUserLgnCustomer's identifier in Payture system. (Email is recommended).
VWUserPswCustomer's password in Payture system.
PhoneNumberCustomer's phone number.
CardIdCard's identifier.
TemplateTagUsed template.
LanguageTemplate language.
merchantPayRegCard
var data = {
    OrderId : 'ORD00000000000000001',
    Amount : 10000,
    IP : '127.0.0.1',
    SecureCode	 : 123,
    CardId : '40252318-de07-4853-b43d-4b67f2cd2077',
    VWUserLgn : '123@ya.ru',
    VWUserPsw : '2645363',
};
ew.merchantPayRegCard(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
OrderIdPayment identifier in your service system.
AmountAmount of payment kopec.
IPCustomer's IP.
SecureCodeCVC2/CVV2.
VWUserLgnCustomer's identifier in Payture system. (Email is recommended).
VWUserPswCustomer's password in Payture system.
CardIdCard's identifier.
ConfirmCodeConfirm code from SMS - if verification code was requested.
CustomFieldsAddition information about customer.
merchantPayNoRegCard
var data = {
    OrderId : 'ORD00000000000000001',
    Amount : 10000,
    IP : '127.0.0.1',
    SecureCode	 : 123,
    CardId : 'FreePay',
    VWUserLgn : '123@ya.ru',
    VWUserPsw : '2645363',
    CardHolder : 'Vasya Petrov',
    CardNumber : '4111111111111112',
    EMonth : 10,
    EYear : 20,
};
ew.merchantPayNoRegCard(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
OrderIdPayment identifier in your service system.
AmountAmount of payment kopec.
IPCustomer's IP.
SecureCodeCVC2/CVV2.
VWUserLgnCustomer's identifier in Payture system. (Email is recommended).
VWUserPswCustomer's password in Payture system.
CardNumberCard's number.
EMonthThe expiry month of card.
EYearThe expiry year of card.
CardHolderCard's holder name.
CardIdCard's identifier.
ConfirmCodeConfirm code from SMS - if verification code was requested.
CustomFieldsAddition information about customer.
payturePay
var sessionId = 'e5c43d9f-2646-42bc-aeec-0b9005ceb972'; 
ew.payturePay(sessionId, callbackFunc);

Description of provided params.

Parameter's nameDefinition
sessionIdValue extracted from init response (where SessionType=Pay(Block))
charge
var data = {
    OrderId : 'ORD00000000000000001',
    Amount : 10000,
};
ew.charge(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
OrderIdPayment identifier in your service system.
AmountAmount of payment kopec.
refund

The data and description for params as the same as for charge function.

ew.refund(data, callbackFunc);
unblock

The data and description for params as the same as for charge function.

ew.unblock(data, callbackFunc);
payStatus
var data = {
    OrderId : 'ORD00000000000000001'
};
ew.payStatus(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
OrderIdPayment identifier in your service system.
sendCode
var data = {
    OrderId : 'ORD00000000000000001',
    Amount : 10000,
    CardId : '40252318-de07-4853-b43d-4b67f2cd2077',
    VWUserLgn : '123@ya.ru',
    VWUserPsw : '2645363'
};
ew.sendCode(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
OrderIdPayment identifier in your service system.
AmountAmount of payment kopec.
VWUserLgnCustomer's identifier in Payture system. (Email is recommended).
VWUserPswCustomer's password in Payture system.
CardIdCard's identifier.

Customer functions:

registerCustomer
var data = {
    VWUserLgn : '123@ya.ru',
    VWUserPsw : '2645363',
    PhoneNumber : '79156783333'
};
ew.registerCustomer(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
PhoneNumberCustomer's phone number.
VWUserLgnCustomer's identifier in Payture system. (Email is recommended).
VWUserPswCustomer's password in Payture system.
EmailCustomer's email.
deleteCustomer
var data = {
    VWUserLgn : '123@ya.ru',
    VWUserPsw : '2645363',
    PhoneNumber : '79156783333'
};
ew.deleteCustomer(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
VWUserLgnCustomer's identifier in Payture system. (Email is recommended).
updateCustomer

The description for params as the same as for registerCustomer function.

var data = {
    VWUserLgn : '123@ya.ru',
    VWUserPsw : '2645363',
    PhoneNumber : '79156783333'
    Email : 'testCustomer@test.com'
};
ew.updateCustomer(data, callbackFunc);
checkCustomer
var data = {
    VWUserLgn : '123@ya.ru',
    VWUserPsw : '2645363',
};
ew.checkCustomer(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
VWUserLgnCustomer's identifier in Payture system. (Email is recommended).
VWUserPswCustomer's password in Payture system.

Card functions:

merchantAddCard
var data = {
    SecureCode	 : 123,
    PhoneNumber : '79001234567',
    VWUserLgn : '123@ya.ru',
    VWUserPsw : '2645363',
    CardHolder : 'Vasya Petrov',
    CardNumber : '4111111111111112',
    EMonth : 10,
    EYear : 20,
};
ew.merchantAddCard(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
SecureCodeCVC2/CVV2.
VWUserLgnCustomer's identifier in Payture system. (Email is recommended).
VWUserPswCustomer's password in Payture system.
CardNumberCard's number.
EMonthThe expiry month of card.
EYearThe expiry year of card.
CardHolderCard's holder name.
PhoneNumberCard's identifier.
paytureAddCard
var sessionId = 'e5c43d9f-2646-42bc-aeec-0b9005ceb972'; 
ew.paytureAddCard(sessionId, callbackFunc);

Description of provided params.

Parameter's nameDefinition
sessionIdValue extracted from init response (where SessionType=Add).
activateCard
var data = {
    Amount : 101,
    CardId : '40252318-de07-4853-b43d-4b67f2cd2077',
    VWUserLgn : '123@ya.ru',
    VWUserPsw : '2645363',
};
ew.activateCard(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
AmountAmount of payment kopec.
VWUserLgnCustomer's identifier in Payture system. (Email is recommended).
VWUserPswCustomer's password in Payture system.
CardIdCard's identifier.
removeCard
var data = {
    CardId : '40252318-de07-4853-b43d-4b67f2cd2077',
    VWUserLgn : '123@ya.ru',
    VWUserPsw : '2645363',
};
ew.removeCard(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
VWUserLgnCustomer's identifier in Payture system. (Email is recommended).
VWUserPswCustomer's password in Payture system.
CardIdCard's identifier.
getCardList
var data = {
    VWUserLgn : '123@ya.ru',
    VWUserPsw : '2645363',
};
ew.getCardList(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
VWUserLgnCustomer's identifier in Payture system. (Email is recommended).
VWUserPswCustomer's password in Payture system.

Payture ApplePay

For use this API just create instanse of PaytureAppleApi object:

var apple = new payture.ApplePay('https://sandbox.payture.com',  { Key : 'YourMerchantAccount', Password : 'YourPassword' });

Please note, that { Key : 'YourMerchantAccount', Password : 'YourPassword' } - fake account, our support help you to get one!

API Functions:

pay

var data = {
    PayToken : 'abcdefg',
    OrderId : 'ORD00000000000000001',,
};
apple.pay(data, callbackFunc);

Description of provided params.

Parameter's nameDefinition
PayTokenPaymentData from PayToken for current transaction
OrderIdPayment identifier in your service system

block

The data and description for params as the same as for pay function.

apple.block(data, callbackFunc);

Visit our site for more information. You can find our contact here.

0.0.10

5 months ago

0.0.9

5 months ago

0.0.8

5 months ago

0.0.7

5 months ago

0.0.6

4 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago