API mobile operator top-up

P2_PHONE request gives the possibility to top-up the numbers of Ukrainian mobile operators.

The request processing result is credit of funds to the mobile operator number balance. 

Request parameters

The request is generated on the side of the merchant and transferred with the help of POST method through HTTP protocol to URL https://api.wayforpay.com/api

In order to confirm the data validity, there shall be generated and transferred in the HMAC_MD5 request the control signature with use of the merchant SecretKey.

The line, subject to HMAC_MD5, is generated through concatenation of UTF-8-encoded merchantAccount, orderReference, amount, currency, phone separated with “;” (semicolon)

 

Parameter

Description

Mandatory

transactionType

P2_PHONE

да

merchantAuthType

Authorization type. May possess one of the following values:

- SimpleSignature (by default)

нет

merchantSignature

Request signature

да

merchantAccount

Merchant identifier. This value is assigned by WayForPay

да

orderReference

Unique order number in the merchant system

да

orderDate

Date of the order placement

да

currency

Top-up currency

да

amount

Order amount

да

phone

Telephone number to be topped-up

да

apiVersion

Protocol version. Default value: 1

да

serviceUrl

URL, where the system shall send the answer with the result of payment directly to the merchant

нет

Response parameters

In order to confirm the data validity, there shall be generated and transferred in the HMAC_MD5 request the control signature with use of the merchant SecretKey.

The line, subject to HMAC_MD5, is generated through concatenation of UTF-8-encoded merchantAccount, orderReference, amount, currency, phone, transactionStatus, reasonCode separated with “;” (semicolon)

Parameter

Description

Example

merchantAccount

Merchant identifier

test_merchant

orderReference

Unique order number in the merchant system

1212dd1

merchantSignature

hash_hmac

 

amount

Order amount

100

currency

Top-up currency

 

phone

Telephone number to be topped-up

380633333333

createdDate

Date of order creation in psp (UTC)

123456789

processingDate

Date of transaction processing (UTC)

12345678

transactionStatus

Transaction status{

"orderReference":"DH783023",

"status":"accept",

"time":1415379863,

"signature":""

}

Approved

reason

Rejection reason

Ok

reasonCode

Rejection code

1100

paymentSystem

Payment system, through which there was made the payment.

card

Request and response example

{
"transactionType":"P2_PHONE",
"merchantAccount":"test_merch_n1",
"merchantAuthType":"SimpleSignature",
"merchantSignature":"60c5d743b71f79abe48c7183ada4b451",
"apiVersion":1,
"orderReference":"myOrder1",
"amount":10,
"currency":"UAH",
"phone":"380633333333"
}
 
serviceUrl request example
{
"merchantAccount":"test_merch_n1",
"orderReference":"DH783023",
"merchantSignature":"",
"amount":10,
"currency":"UAH",
"createdDate":12345678,
"processingDate":12345678,
"transactionStatus":"Approved",
"reason":1100,
"reasonCode":""
}

Example of the correct answer from the merchant

WayForPay waits for the following answer from the merchant server:

{
"orderReference":"DH783023",
"status":"accept",
"time":1415379863,
"signature":""
}

 

In order to confirm the data validity, there shall be generated and transferred in the HMAC_MD5 request the control signature with use of the merchant SecretKey.

The line, subject to HMAC_MD5, is generated through concatenation of UTF-8-encoded orderReference, status, time separated with “;” (semicolon)

Merchant notification as to the transaction status

For authorized and verified orders (as well as in case of the order status change) the WayForPay server sends to serviceUrl the request (HTTP_POST) with order details. This information is supplemented with HMAC_MD5 control signature.

In case WayForPay does not receive correct answer from the merchant server, the system will send the requests within 4 days or until correct answer reception.