Create invoice
The request with required parameters is to be formed on the side of the merchant and to be transferred by POST method through HTTP protocol to URL https://api.wayforpay.com/api
Requests authentication
For the purposes of confirmation of data validity there should be generated and transferred in the request the HMAC_MD5 control signature using SecretKey of merchant.
The line which subjects to HMAC_MD5 is generated through catenation of parameters merchantAccount, merchantDomainName, orderReference, orderDate, amount, currency, productName[0],
productName[1]..., productName[n], productCount[0], productCount[1],..., productCount[n], productPrice[0], productPrice[1],..., productPrice[n] divided with “;” (semi-column) in coding UTF-8
PARAMETER | DESCRIPTION | OBLIGATORY |
---|---|---|
transactionType | CREATE_INVOICE | yes |
merchantAccount | Seller’s identifier. This value is to be assigned to You from the side of WayForPay | yes |
merchantAuthType | Authorization type: simpleSignature | no |
merchantDomainName | Domain name of the merchant’s web-site | yes |
merchantSignature | Signing of the request | yes |
apiVersion |
| yes |
language | Language in which an invoice will be issued. May take one of the following values:
|
no |
serviceUrl | URL to which the system should sent notification with the result of payment of invoice directly to the merchant | no |
orderReference | Unique number of invoice in the merchant’s system | yes |
amount | Amount to be paid | yes |
currency | Currency of order UAH | yes |
alternativeAmount | Alternative amount of order | no |
alternativeCurrency | Alternative currency of order USD, EUR | no |
orderTimeout | Sets the active time of invoice during which the client may try to pay it. On default the invoice is available for payment within 1 hour | no |
productName[] | Array with the names of ordered products | yes |
productPrice[] | Array with the prices per product unit. This information will be visible at the page of order payment | yes |
productCount[] | Array with the quantity of ordered goods by each item. | yes |
paymentSystems | The list of payment systems available for client in case of selection of payment method at the payment page. The systems should be divided with semi-column. Available payment systems: - card - googlePay - applePay - privat24 - lpTerminal - delay - bankCash - qrCode - masterPass - visaCheckout - bot - payment method in messengers (bot wayforpay) - payParts (instant installment plan from PrivatBank)* - payPartsMono (purchase of parts from Monobank)* - payPartsPrivat (payment by parts from PrivatBank)* - payPartsAbank (pay in installments from A-Bank)* - instantAbank (instant installment plan from A-Bank)* - globusPlus (payment by parts from Globus+ from Globus Bank)* - payPartsOschad (payment by parts from Oschadbank)* - OnusInstallment (instant installment plan from Raiffeisen Bank )
*For installment payments or installment payments, you can transfer the number of parts available to the client on the payment page, the number of parts is indicated by a comma after ":". For instance: payPartsAbank:2,3,7,10;payParts:5
On default all the payment systems allowed for the merchant are available for client. | no |
clientFirstName | Client name (minimal length 1 symbol) | no |
clientLastName | Client surname (minimal length 1 symbol) | no |
clientEmail* | Client Email to which the invoice will be sent | no |
clientPhone | Client’s phone number (minimal length 9 and maximal length 13 figures) | no |
* - if the client’s email is not assigned then the notification to the client about invoice will not be sent but invoiceUrl will be provided in response.
Response parameters:
REASON | REASON FOR REFUSAL |
|
reasonCode | Code of refusal |
|
invoiceUrl | url by which the payment page will be opened for the client for payment of invoice |
|
An example of request and response
{
"transactionType":"CREATE_INVOICE",
"merchantAccount":"test_merch_n1",
"merchantAuthType":"SimpleSignature",
"merchantDomainName":"www.super.org",
"merchantSignature":"60c5d743b71f79abe48c7183ada4b451",
"apiVersion":1,
"language":”ru”,
"serviceUrl":”http://serviceurl.com”,
"orderReference":"myOrder1",
"orderDate":1421412898,
"amount":1547.36,
"currency":"UAH",
"orderTimeout": 86400,
"productName":["Samsung WB1100F","Samsung Galaxy Tab 4 7.0 8GB 3G Black"],
"productPrice":[21.1,30.99],
"productCount":[1,2],
"paymentSystems": "card;privat24",
"clientFirstName":"Bulba",
"clientLastName":"Taras",
"clientEmail":"rob@mail.com",
"clientPhone":"380556667788"
}
{
"reason":"1100",
"reasonCode":"Ok",
"invoiceUrl":"https://secure.wayforpay.com/pay/invoice?acc=netpeaknet&id=5534eb845b744d27b3ca57eb38a74599&sign=a4a923edd74f9b23bdd8922b4a2d8630",
"qrCode": "https://wayforpay.com/qr/img/i343c70e046af?size=200"
}
Notification of merchant about the status of invoice payment
For authorized and checked orders (as well as in case of change of order status) WayForPay server sends to serviceUrl a request (HTTP_POST) which includes the order data..
This information is to be supplemented with a control signature HMAC_MD5.
In case if WayForPay WILL NOT obtain correct response from the merchant’s server the system will sent the requests during 4 days or until obtaining of correct response.
Parameters of request of WayForPay gate to serviceUrl
For the purposes of confirmation of data validity there should be generated and transferred in the request the HMAC_MD5 control signature using SecretKey of merchant.
The line which subjects to HMAC_MD5 is generated through catenation of parameters merchantAccount, orderReference, amount, currency, authCode, cardPan, transactionStatus, reasonCode divided with “;” (semi-column) in coding UTF-8
PARAMETER | DESCRIPTION | EXAMPLE |
---|---|---|
merchantAccount | Seller’s identifier | test_merchant |
orderReference | Unique number of the order in merchant’s system | 1212dd1 |
merchantSignature | hash_hmac |
|
amount | Amount of order | 100 |
currency | Currency of order | UAH |
authCode | authorization code - assigned by Bank | 324567 |
| payer email | |
phone | Phone number of the payer | +38063-333-33-33 |
createdDate | Date of creation request in psp | 123456789 |
processingDate | date of transaction processing | 12345678 |
cardPan | Masked card number | 42****4242 |
cardType | Card type: Visa/MasterCard | Visa |
issuerBankCountry | Country of card | Ukraine |
issuerBankName | Name of the Bank card | PrivatBank |
recToken | { "orderReference":"DH783023", "status":"accept", "time":1415379863, "signature":"" }card token for recurring payments | 121213321-3213213-3213213-321-3 |
transactionStatus | transaction status | Approved |
reason | Reason for refusal | Ok |
reasonCode | Code of refusal | 1100 |
fee | Commission psp | 0.00 |
paymentSystem | The payment system, through which the payment was made. | card |
An example of request on serviceUrl
{
"merchantAccount":"test_merch_n1",
"orderReference":"myOrder1",
"merchantSignature":"",
"amount":"1547.36",
"currency":"UAH",
"authCode":"541963",
"email":"client@mail.ua",
"phone":"380501234567",
"createdDate":"",
"processingDate":"",
"cardPan":"4102****8217",
"cardType":"visa",
"issuerBankCountry":"980",
"issuerBankName":"Privatbank",
"recToken":"",
"transactionStatus":"Approved",
"reason":"1100",
"reasonCode":"",
"fee":"",
"paymentSystem":"card"
}
Example of correct response from the merchant
WayForPay system expects to obtain from the merchant’s server the following response:
{
"orderReference":"myOrder1",
"status":"accept",
"time":1415379863,
"signature":""
}
For the purposes of confirmation of data validity there should be generated and transferred in the request the HMAC_MD5 control signature using SecretKey of merchant.
The line which subjects to HMAC_MD5 is generated through catenation of parameters orderReference, status, time divided with “;” (semi-column) in coding UTF-8