API lang.documentation

Payment Service Provider API

Portmanat Card

 

- Wordpress Plugin

What is Payment Service Provider (PSP)?

Payment Service Provider is intended for collaborating with business partners to help them to accept payments via plastic card. Using this service, you will provide your users with the opportunity of making payments without any negotiation with banks.

 

This documentation consists of the steps below.

Partners have to:

  • Sign up on this page: https://psp.mps.az/register
  • Then create service and wait for the confirmation
  • Afterwards use the instructions shown below in their project

 

In case of creating new service partner should fill required fields:

(Title, Description, Callback URL, Secret key, IP address)

*Callback URL is intended to redirect the user to determine the result of payment after entering card credentials.

 

Instruction

a) Partner should send request for generating PSP RRN.

b) Using this RRN partner should redirect the user to PSP.

c) After completing payment process the user will be redirected to callback URL entered by partner when he will have created the service.

 

Generate PSP RRN

Request method: POST

URL: https://psp.mps.az/process

 

Parameters:

service_id - ID number of partner's service

client_rrn - Transaction number on partner's side

amount - Amount that will be payed

client_ip - IP address of client that will do payment

hash - HASH code

 

Hash will be generated with SHA256 method like as below:

 

secret_key => Secret key generated by partner when creates a service

 

hash = hash_hmac('sha256', service_id.client_rrn.amount, secret_key)

 

 

If everything is right, client will be prompted to check datas. After submitting he will be redirected to the page of bank to enter card credentials.

 

 

How to know the result of transaction

To be able to know the result of transaction partner should send request to the URL showed below this transaction number.

 

URL: https://psp.mps.az/check

 

Parameters:

psp_rrn - Transaction number

 

Response:

{

"status": "OK",

"code": "-1",

"description": "Request failed",

"body": {

"amount": "1.23",

"client_rrn": "1471855074",

"psp_rrn": "1471851442-lfI7yG-vTuaxI-x87xAS",

"bank_rrn": "gV1Pwgz6HmXJphEMVLEUUnp+sD8=",

"date": {

"date": "2016-08-22 11:37:23.000000",

"timezone_type": 3,

"timezone": "Asia/Baku"

}

}

}

 

Response statuses

OK - everything is right with request

BAD - something went wrong with request parameters

 

Code statuses

-1 - Request failed

0 - OK

1 - Pending

 

You should consider the result of the payment according to “code” parameter.

 

Other examples on check request:

 

{

"status": "BAD",

"code": 20,

"description": "RRN is wrong"

}

 

{

"status": "BAD",

"code": 10,

"description": "Validation error",

"errors": {

"psp_rrn": [

"The psp rrn field is required."

]

}

}