Embedding PortmoneDirect bill payment service into customer service banking systems. Technical description
Glossary
| Term | Definition |
|---|---|
| Merchant, Partner | Organization which has signed a payment acceptance agreement with Portmone.com |
| Buyer, Client or Customer | A person who visits the Merchant's Online Store in order to learn about the range of goods (services) and to make a purchase |
| Card, Payment Card | Payment cards of Visa, Mastercard international card associations and the National payment system PROSTIR |
| Authorization | The process of giving access rights or other powers to the Buyer, program or process |
| CVV2/CVC2 | CVV2 (Card Verification Value 2) is a three-digit card security code that helps to verify legitimacy of a Visa payment card. The Mastercard payment system has similar card security code called CVC2 (Card Validation Code 2) |
| Acquiring Bank | A bank that organizes banking cards acceptance points (terminals, ATM’s) and processes full range of financial operations connected with performing bank settlements and payments by banking cards at that points |
| Issuing Bank (Card Issuing Bank) | A bank licensed as a member of a card association (like Visa or Mastercard), that issues and maintains payment cards |
| IBAN | International Bank Account Number |
1. General information
The PortmoneDirect uses Representational State Transfer (REST) technology. Requests and responses are transferred over the HTTPS channel (note that at the moment only TLS 1.2 protocol is supported by the server).
The execution of methods with the required parameters is to be formed on the side of merchant and to be transferred to the Portmone.com server by POST requests.
** Please note ** that all parameters are transferred in the body of the POST request, in no case in the body of the URL. In query examples, the
?sign is specified at the beginning of the string - this is not an indication for the use of GET messages.
Endpoint URL: https://direct.portmone.com.ua/api/directcash/.
Each request must contain two mandatory parameters - login and password (login and password of the reseller company). The login, password and HTTPS certificate should be provided by the Portmone manager.
The response format is XML. UTF-8 encoding is used for data transferring.
The date format is DD.MM.YYYY.
An example of request for bill delivery:
method=bills.create&login=login&password=password&version=2&payeeId=value&contractNumber=value
An example of successful response:
<?xml version="1.0" encoding="utf-8"?>
<rsp status="ok">
[xml-data there]
</rsp>
An example of response in case of an error:
For version 1:
<?xml version="1.0" encoding="utf-8"?>
<rsp status="fail">
<error code="Error code">Error description</error>
</rsp>
For version 2 and higher:
<?xml version="1.0" encoding="utf-8"?>
<rsp status="fail">
<error code="Error code">Error description</error>
<error_description>Detailed error description (protocol version - 2)</error_description>
</rsp>
Protocol
By default, the protocol version is “1”.
If the parameter version = 2 is transferred in the request, additional tags entered for the protocol version “2” become available.
Localization
Optional parameter lang added to the protocol version “2” (possible values are: ru - Russian, uk - Ukrainian, en - English). The parameter localizes attribute values and service names in the response (but not the company name). If the parameter is not passed, the result is returned in Ukrainian.
If you use the protocol version 2 (version = 2) and the values of the lang parameter in the request, the values of <name/> and <*_name/> tags in the <tariff_items> block of the response will be returned localized to the needed language.
For the protocol version 2 (version = 2), the <tariff_items> block of the response does not contain the <name_ua/> and the <name_en/> tags (due to the lang parameter using).
An example of using the lang parameter.
Request:
method=bills.create&payeeId=1755&login=PortmoneDirectTest&password=**************
&version=2&contractNumber=639512625&lang=uk
Response:
<rsp status="ok">
<bill id="598984149">
<payee id="1755">lifecell</payee>
<contractNumber title="Номер телефона (без +380)">639512625</contractNumber>
<attribute1/>
<attribute2/>
<attribute3/>
<attribute4/>
<bill_attribute1/>
<bill_attribute2/>
<bill_attribute3/>
<bill_attribute4/>
<date>21.01.2020</date>
<description>Рахунок створений автоматично для поповнення балансу</description>
<amount>0.00</amount>
<debt>0.00</debt>
<sum>0.00</sum>
<status>created</status>
<paidAmount/>
<payDate/>
<payee_export_flag/>
<auth_code/>
<transaction_id/>
<payment_point/>
</bill>
</rsp>
The <contractNumber title> parameter is localized in Russian.
Description of XML-structure
To study structure of XML-response refer to Attachment 1.
Notifications of Invoice Uploads by Company
Partner notifications are sent after an invoice is uploaded for each company. The partner must provide a URL that can receive a POST request for further processing on their side.
Request examples:
<?xml version="1.0" encoding="UTF-8"?><req name="billsLoaded"><payee id="16020"/></req>
<?xml version="1.0" encoding="UTF-8"?><req name="billsLoaded"><payee id="140264"/><payee id="140235"/></req>
2. Methods
| Method name | Description |
|---|---|
| 2.1. bills.create | this method is used to create a subscription on the Portmone.com side to receive bills for the required company and return the bill ID (billId) |
| 2.2. bills.createByPhone | this method is used to create a bill on the Portmone.com side to add funds to a mobile phone account and return the ID of the payee company (payeeId) and the bill ID (billId) |
| 2.3. bills.createAll | this method is used to get bills from companies issuing several bills for the current month |
| 2.4. bills.pay | this method is used to pay bills |
| 2.5. bills.get | This method is used when you need to get information about a bill. You need to send request l if the method bills.pay received a connection error, received a response of an unexpected format that does not match the protocol. And also if errors p009, p017, p100 are received. |
| 2.6. bills.paymentOrder | this method is used to transfer a list of transactions and payment details of cover payment from bank to the Portmone.com system |
| 2.7. bills.date | this method is used to obtain a control registry of transactions for the period (day) |
| 2.8. bills.exported | this method is used to obtain a control registry of transactions for the period (day), the funds for which were sent to the service provider (biller) |
| 2.9. bills.balance | this method is used to view the current balance of the biller company (PAYEE) |
| 2.10. bills.payees | this method is used to get biller (PAYEE) parameters |
| 2.11. bills.regions | this method is used to obtain a list of available regions and a list of billers (PAYEE) for each region |
| 2.12. bills.additionalPayees | this method is used to get a list of companies for which the client can pay bills |
| 2.13. search.regions | this method is used to obtain a complete list of regions of Ukraine |
| 2.14. search.regionsExtended | this method is used to obtain a list of regions of Ukraine with additional filtering by region name |
| 2.15. search.citiesByRegion | this method is used to get a list of cities for the specified region |
| 2.16. search.citiesByRegionExtended | this method is used to get a list of cities for the specified region with additional filtering by city name |
| 2.17. search.streetsByCity | this method is used to get a list of streets for the specified city |
| 2.18. search.streetsByCityExtended | this method is used to get a list of streets for the specified city with additional filtering by street name |
| 2.19. search.housesByStreet | this method is used to get a list of buildings for the specified street |
| 2.20. search.housesByStreetExtended | this method is used to get a list of buildings for the specified street with additional filtering by building number |
| 2.21. search.apartmentsByHouse | this method is used to obtain a list of apartments by known houseId. For apartment buildings only |
| 2.22. search.apartmentsByHouseExtended | this method is used to obtain a list of apartments by known houseId with additional filtering by apartment number. For apartment buildings only |
| 2.23. search.userDocsByAddress* | this method is used to obtain a list of bills by known houseId (for private houses) or apartmentId (for apartment buildings). Returns bills with the full match by the address |
| 2.24. companies.top10ByRegion* | this method is used to get a list of the TOP 10 companies by regionId (partial match) |
| 2.25. companies.top10ByCity* | this method is used to get a list of the TOP 10 companies by cityId (partial match) |
| 2.26. companies.top10ByStreet* | this method is used to get a list of the TOP 10 companies by streetId (partial match) |
| 2.27. companies.top10ByHouse* | this method is used to get a list of the TOP 10 companies by known houseId (full match for house or partial match for apartment) |
| 2.28. companies.top10ByAddress* | this method is used to get a list of the companies by known houseId (for private houses) or apartmentId (for apartment buildings). Returns bills with the full or partial match by the address |
| 2.29. bills.getreference | this method is used to obtain a list of values of the specified dictionary using the related value from the upper-level dictionary |
| 2.30. bills.update | is a part of method 2.4. bills.pay, is used for update a bill with no change of its status |
| 2.31. bank.params.guaranteeAmount | the method of checking the amount of the guarantee payment for the partner according to the individual login |
| 2.32. bills.recreate | this method to create a copy of a paid invoice |
| 2.33. bills.cancel | this method for canceling payments that are in PAYED status (all versions of the protocol) |
| 2.34. counters.get | мethod for submitting meter readings without payment (for incoming companies) — creating a request |
| 2.35. counters.set | мethod for submitting meter readings without payment (data transmission to the company, readings entered by the customer). |
* How to use companies searching methods
- If only the
regionIdis known, use the companies.top10ByRegion method for searching bills by region- If the
cityIdis known, use the companies.top10ByCity method for searching bills by the specified locality (city)- If the
streetIdis known, use the companies.top10ByStreet method for searching bills for a specified street- If the
houseIdis known, use the companies.top10ByHouse method for searching bills for a specified building- If house has apartments (
hasApartments=Y) andapartment idis known, use the companies.top10ByAddress method (if there is no full match by the address, the method searches for bills by higher steps (by home, street, city, etc.)) or the search.userDocsByAddress method (returns bills with the full match for search parameter).
2.1. Request for bill delivery
Method: bills.create
Description of the method: the result of calling this method is creating a subscription on the Portmone.com side to receive bills for the required company and return the bill ID (billId - unique payment identifier). The answer contains data about the last available unpaid bill. If the company does not provide invoices, the wallet system creates an invoice for 0 amount and returns it to the partner for payment.
Before calling the bills.create method, you need to pay attention to <balance_source> tag value, obtained during the execution of the bills.payees method. If the value is <balance_source>Y</balance_source> for the company, you should use the bills.create method. In other cases call the bills.createAll method.
Method parameters:
| Parameter | Description | Required |
|---|---|---|
| login | Your company login in the Portmone.com system | Yes |
| password | Your company password in the Portmone.com system | Yes |
| method | A name of the method | Yes |
| payeeId | ID of the payee company | Yes |
| contractNumber | The main requisite (identifier) of the client in this company | Yes |
| billNumber | Order number | No |
| attribute1-4 | For additional information | No |
An example of request:
method=bills.create&login=login&password=password&version=2&payeeId=value&contractNumber=value
An example of successful response: see Attachment 1.
An example of response in case of an error:
<?xml version="1.0" encoding="utf-8"?>
<rsp status="fail">
<error code="Error code">Error description</error>
</rsp>
2.2. Request for bill delivery by phone number
Method: bills.createByPhone
Description of the method: this method is used to create a bill on the Portmone.com side to add funds to a mobile phone account and return the ID of the payee company (payeeId) and the bill ID (billId).
To pay the bill call the bills.pay method.
Interaction scheme:
- The Client enters the mobile phone number on the Partner's website.
- The Partner sends this data to the Portmone.com using the bills.createByPhone method.
- Portmone.com identifies the ID of the company to which the client’s phone belongs by the mobile network operator code, and sends an XML-message with the ID of the payee company (
payeeId) and the bill ID (billId) to the Partner. - The Partner sends the payment request using the bills.pay method.
- Portmone.com transfers funds to the service provider.
Method parameters:
| Parameter | Description | Required |
|---|---|---|
| login | Your company login in the Portmone.com system | Yes |
| password | Your company password in the Portmone.com system | Yes |
| method | A name of the method | Yes |
| payeeId | ID of the payee company | Yes |
| contractNumber | Phone number to which funds are transferred. Format of the number: 9 digits, without "+380" (for example, 673334411) | Yes |
| billAmount | Amount of payment (default to 0) | No |
| billNumber | Order number | No |
| attribute1-4 | For additional information | No |
An example of request:
method=bills.createByPhone&login=login&password=password&version=2&contractNumber=value&billAmount=value
An example of successful response:
<rsp status="ok">
<bill id="508828105">
<payee id="2065">Київс тар</payee>
<contractNumber title="Номер телефону (без +380)">973452341</contractNumber>
<attribute1/>
<attribute2 title="Номер квитанції Київстар"/>
<attribute3/>
<attribute4/>
<bill_attribute1/>
<bill_attribute2/>
<bill_attribute3/>
<bill_attribute4/>
<date>12.06.2019</date>
<description>Рахунок створений автоматично для поповнення балансу</description>
<amount>0.00</amount>
<debt>0.00</debt>
<sum>0.00</sum>
<status>created</status>
<paidAmount/>
<payDate/>
<payee_export_flag/>
<auth_code/>
<transaction_id/>
<payment_point/>
</bill>
</rsp>
An example of response in case of an error:
<?xml version="1.0" encoding="utf-8"?>
<rsp status="fail">
<error code="Error code">Error description</error>
</rsp>
2.3. Request for delivery of all bills issued for the current month
Method: bills.createAll
Description of the method: to get bills from companies issuing several bills for the current month, use the bills.createAll method. In terms of parameter set, this method is completely identical to the bills.create method.
Method parameters:
| Parameter | Description | Required |
|---|---|---|
| login | Your company login in the Portmone.com system | Yes |
| password | Your company password in the Portmone.com system | Yes |
| method | A name of the method | Yes |
| payeeId | ID of the payee company | Yes |
| contractNumber | The main requisite (identifier) of the client in this company | Yes |
| billNumber | Order number | No |
| attribute1-4 | For additional information | No |
An example of request:
method=bills.createAll&login=login&password=password&version=2&payeeId=value&contractNumber=value
An example of successful response: in case of success, the bills section is returned, containing XML described in Attachment 1 for each of the bills.
<?xml version="1.0" encoding="utf-8"?>
<rsp status="ok">
<bills>
<bill id="id">
…
</bill>
<bill id="id">
…
</bill>
<bill id="id">
…
</bill>
</bills>
</rsp>
An example of response in case of an error:
<?xml version="1.0" encoding="utf-8"?>
<rsp status="fail">
<error code="Error code">Error description</error>
</rsp>
Main company and recipient companies:
The Portmone.com system allows you to split a payment, that is, crediting the amount of payment received from the client to several recipients (suppliers of goods or service providers).
Main company is a company that you display to the client when paying for a service/product and indicate in requests for getting bills. Such companies are created, for example, in order to group services provided (e.g. a company with payeeId = 8004 and a company with payeeId = 4568).
Recipient company is an active company that provides a service or a product, but it is not displayed to the client.
When you send a request with payeeId of main company, the bills.createAll method returns you bills with the payeeId of recipient companies for which payments will be made.
2.4. Bill payment
Method: bills.pay
Description of the method: performs debiting of funds on the client's payment card.
In the event that the service debt_state <> 'E', then the corresponding debt should not be taken into account in the total amount of payment on the account
Method parameters:
| Parameter | Description | Required |
|---|---|---|
| login | Your company login in the Portmone.com system | Yes |
| password | Your company password in the Portmone.com system | Yes |
| method | A name of the method | Yes |
| billId | Bill ID. The value returned by the bills.create method (or by the bills.createByPhone method in case of a mobile phone replenishment) | Yes |
| amount | Amount for payment by order (it may differ from the one proposed in the bill) | Yes |
| auth_code | Authorization code | No |
| transaction_id | Transaction ID | No |
| payment_point | Unique description of a partner sales point | Yes |
| payer_iban or payer_card_number or payer_phone_number | the sender's iban, who initiates the transfer, takes the value of 29 characters ------------------------------------------------------------------------------ The card, the sender, who initiates the transfer, takes the value of 16 digits ------------------------------------------------------------------------------ Payer's phone number in the format | Yes |
An example of request for company without items:
method=bills.pay&login=login&password=password&version=2&billId=value&amount=value&payer_iban=value
or
method=bills.pay&login=login&password=password&version=2&billId=value&amount=value&payer_card_number=value
An example of successful response:
<?xml version="1.0" encoding="utf-8"?>
<rsp status="ok">
<bill id="1046347926">
<payee id="6968">Воля ТБ та/або Інтернет</payee>
<contractNumber title="Номер договору">901386637</contractNumber>
<attribute1 title="Адреса">Київ, Архипенка Олександра, б.4А, кв.185</attribute1>
<attribute2 />
<attribute3 />
<attribute4 />
<bill_attribute1 />
<bill_attribute2 />
<bill_attribute3 />
<bill_attribute4 />
<date>11.01.2022</date>
<description>Рахунок створений автоматично для поповнення балансу</description>
<amount>0.00</amount>
<debt>0.00</debt>
<sum>0.00</sum>
<status>paid</status>
<paidAmount>31000.00</paidAmount>
<payDate>12.01.2022 08:49:29</payDate>
<payee_export_flag>N</payee_export_flag>
<auth_code />
<transaction_id />
<payment_point>PORTMONEDIRECTTEST</payment_point>
<bill_attribute10>UA77*********************6900</bill_attribute10>
</bill>
</rsp>
If payer_iban and payer_card_number are missing, the system will return an error
An example of response in case of an error:
<rsp status="fail">
<error code="р013">Incorrect customer identification parameters</error>
<error_description>Incorrect customer identification parameters</error_description>
</rsp>
Parameters for payments exceeding 30,000 UAH (non-cash payments), 4,999 UAH (cash payments)::
Description: According to the legislation of Ukraine: for payments exceeding 30,000 UAH (except for utility services and taxes) in the case of non-cash payments, and for all service categories exceeding 4,999 UAH in the case of cash payments, it is required to provide and store the customer’s full name and tax identification number (TIN) linked to the transaction (or full name and date of birth if the customer does not have a TIN due to religious beliefs).
| Parameter | Description | Required |
|---|---|---|
| login | Your company login in the Portmone.com system | Yes |
| password | Your company password in the Portmone.com system | Yes |
| method | A name of the method | Yes |
| billId | Bill ID. The value returned by the bills.create method (or by the bills.createByPhone method in case of a mobile phone replenishment) | Yes |
| amount | Amount for payment by order (it may differ from the one proposed in the bill) | Yes |
| first_name | Customer’s first name | Yes |
| last_name | Customer’s last name | Yes |
| middle_name | Customer’s middle name (patronymic) | Yes |
| taxId | Customer’s TIN | Так |
| birth_date | Customer’s date of birth | Yes, if the customer does not have a TIN due to religious beliefs |
Example request for payments exceeding 30,000 UAH:
curl --location --request POST 'http://127.0.0.1/api/directcash' \
--form 'version="2"' \
--form 'lang="uk"' \
--form 'login="PortmoneDirectTest"' \
--form 'password="PortmoneDirect"' \
--form 'method="bills.pay"' \
--form 'billId="1046347926"' \
--form 'amount="31000"' \
--form 'first_name="Антон"' \
--form 'last_name="Волоха"' \
--form 'middle_name="Олександрович"' \
--form 'taxId="9999"' \
--form 'birth_date="03.08.1998"'
--form 'payer_iban="UA773510050000026003590876900"'
An example of successful response:
<?xml version="1.0" encoding="utf-8"?>
<rsp status="ok">
<bill id="1078035627">
<payee id="6968">Воля ТБ та/або Інтернет</payee>
<contractNumber title="Номер договору">901386637</contractNumber>
<attribute1 title="Адреса">Київ, Архипенка Олександра, б.4А, кв.185</attribute1>
<attribute2 />
<attribute3 />
<attribute4 />
<bill_attribute1 />
<bill_attribute2 />
<bill_attribute3 />
<bill_attribute4 />
<date>11.01.2022</date>
<description>Рахунок створений автоматично для поповнення балансу</description>
<amount>0.00</amount>
<debt>0.00</debt>
<sum>0.00</sum>
<status>paid</status>
<paidAmount>31000.00</paidAmount>
<payDate>12.01.2022 08:49:29</payDate>
<payee_export_flag>N</payee_export_flag>
<auth_code />
<transaction_id />
<payment_point>PORTMONEDIRECTTEST</payment_point>
<bill_attribute10>UA77*********************6900</bill_attribute10>
</bill>
</rsp>
An example of response in case of an error:
<?xml version="1.0" encoding="utf-8"?>
<rsp status="fail">
<error code="o003">
<![CDATA[Ошибка при оплате счета.]]>
</error>
<error_description>
<![CDATA[bills.pay 02 - Счета нет или счет уже оплачен.]]>
</error_description>
</rsp>
Parameters for "universal" items (transferred into <tariff_items> array):
| Parameter | Description | Required |
|---|---|---|
| id | Counter ID | Yes |
| amount | The amount of the counter in UAH | Yes |
| prev_counter | Previous counter value | No |
| counter | Current counter value | No |
| tariff | Tariff value in UAH | No |
| subsidy | Subsidy in UAH | No |
| debt | Debt in UAH | No |
| attribute1 | Optional tag (depends on biller) (protocol version - 2) | No |
| attribute2 | Optional tag (depends on biller) (protocol version - 2) | No |
| attribute3 | Optional tag (depends on biller) (protocol version - 2) | No |
prev_counter, counter, tariff, subsidy, debt, attribute1, attribute2, attribute3 parameters are transferred if the corresponding tags in the received bill are not empty.
If a parameter is transferred, it must have a value (“empty” parameters are not allowed).
The invoiced amount entirely paid must be equal to the sum of the transferred amount and debt values for all items.
An example of request for company without items:
method=bills.pay&login=login&password=password&version=2&billId=value&amount=value