Withdrawal request

Before making real payments, the merchant must be informed of the corporate card (IBAN account number) and the TerminalID number for registration in the system. The request must be sent to dev.epay@halykbank .kz

During registration, you will be given the data that you will need to use when making the payment:

TerminalIDStore ID
ClientIDClient ID
ClientSecretSecret key

Test merchant

urlhttps://test-epay.homebank.kz
emailepay@halykbank.kz
passwordXZG1E@Mm
ClientIDtest
ClientSecretyF587AV9Ms94qN2QShFzVR3vFnWkhjbAK3sG
TerminalIDc36b282f-6819-4d4f-85df-a4bdc8a8f703

Test payment card

PANExpire DateCVCStatus
440563970401509601/25815unlock
552204270506673601/25525unlock
37751450000079409/231687unlock
400303270454759709/20170lock
557834271075056009/20254lock

Getting a token to make a payment (for each operation, you must receive and use the original token)

TEST URL POST https://testoauth.homebank.kz/epay2/oauth2/token
PROD URL POST https://epay-oauth.homebank.kz/oauth2/token

Request

Body: form-data

grant_type: "client_credentials"
scope: " webapi usermanagement email_send verification statement statistics payment"
client_id: "test"
client_secret: "yF587AV9Ms94qN2QShFzVR3vFnWkhjbAK3sG"
invoiceID: "000000001"
amount: 100
currency: "KZT"
terminal: "c36b282f-6819-4d4f-85df-a4bdc8a8f703"
postLink: ""
failurePostLink: ""

FieldDescription
grant_typeAuthorization type, client_credentials type is used for making a payment
scopeResource
client_idMerchant ID, can be obtained in the cabinet, issued during registration
client_secretThe merchant's access key, which can be obtained in the cabinet, is issued upon registration
invoiceIDThe order number generated by the merchant must be unique for each new order, from 6 to 15 digits. If your order number contains more than 6 characters, then additionally uniqueness must be observed for the last 6 characters
amountOrder amount
currencyCurrency
terminalThe ID of the point of sale, which can be obtained in the cabinet, is issued during registration
postLinkRequired parameters, sending postlink if successful
failurePostLinkOptional parameters, sending a postlink in case of failure

Response

{
"access_token":"DCEB8O_ZM5U7SO_T_U5EJQ",
"expires_in": 7200,
"refresh_token":"",
"scope":" webapi usermanagement email_send verification statement statistics payment",
"token_type":"Bearer"
}

FieldDescription
access_tokenToken for the operation
expires_inToken expiration time
refresh_tokenNot used for this type of authorization
scopeResource, a resource is used for making a payment
token_typeAuthorization type

Redirection to the withdrawal page

On the page you need to connect the JS library and call the halyk.oct() method in it.

URL TEST: https://test-epay.homebank.kz/payform/payment-api.js
URL PROD: https://epay.homebank.kz/payform/payment-api.js

The following parameters must be passed to the halyk.oct() method.

var createPaymentObject = function(auth, invoiceId, amount) {
var paymentObject = {
InvoiceID: "000000001",
backLink: "https://example.kz/success.html ",
failureBackLink: "https://example.kz/failure.html ",
postLink: "https://example.kz /",
failurePostLink: "https://example.kz/order/1123/fail ",
language: "rus",
description: "Payment in an online store",
AccountId: "testuser1",
terminal: "c36b282f-6819-4d4f-85df-a4bdc8a8f703",
amount: 100,
data: "{\"statement\":{\"name\":\"Arman Ali\",\"invoiceID\":\"80000016\"}}",
currency: "KZT",
phone: "77777777777",
email: "example@example.com"
paymentObject.auth = auth;
return paymentObject;
};

halyk.pay(createPaymentObject(auth, invoiceId, amount));

FieldDescription
invoiceIdThe order number generated by the merchant must be unique for each new order, from 6 to 15 digits. If your order number contains more than 6 characters, then additionally uniqueness must be observed for the last 6 characters
backLinkLink to return to the store with a successful payment
failureBackLinkLink to return to the store in case of a failed payment
postLinkPayment Notification
failurePostLinkNotification of a failed payment, if not filled in, the information will be sent to the address specified in the postLink
languageLanguage rus/kaz/eng
descriptionOrder description, allowed number of characters 125 bytes
accountIdOptional field for specifying the store's customer ID
terminalStore ID
amountOrder amount
currencyCurrency
phoneCustomer's phone number (optional)
emailClient email (optional)
authToken / is transmitted completely as an object, all data received from epay at the request of the token
dataAdditional field is translated in the report when filling in (optional)

Postlink

A message will be sent to the specified URL specified in the postLink field. If you have not received a postlink, we recommend using the [Transaction Status] service (https://epayment.kz/ru/docs/P2P-CHECK-STATUS-BY%20TERMID ).

Response if successful:

``json { "id": "3e215f23-8378-4a22-c33b-324sd2c3f5", "amount": 100, "accountID": "epayment.KZ", "currency": "KZT", "email": "email@gmail.com", "description": "TEST p2p", "reference": "306177717717", "invoiceID": "000000001", "intReference": "", "terminalID": "c36b282f-6819-4d4f-85df-a4bdc8a8f703", "senderCardID": "", "senderCardPAN": "440563...11111", "senderCardType": "VISA", "senderTransferType": "TYPEPAN", "senderCardIssuer": "HALYK BANK", "receiverCardID": "", "receiverCardPAN": "400303...0011", "receiverCardType": "VISA", "receiverTransferType": "TYPEPAN", "receiverCardIssuer": "HALYK BANK", "secure": false, "reason": "Successfully completed", "reasonCode": "00", "name": " ", "phone": "", "datetime": "2023-03-02T10:33:26.11129789+06:00", "status": "ok", "data": "", "post_link": "https://epay.homebank.kz/payform", "failure_post_link": "https://testmerchant/order/000000001/fail", "p2pType": "OCT" }


[Response Codes](https://epayment.kz/ru/docs/kody-oshibok )

### Response in case of failure:
```json
{
"id": "3e215f23-8378-4a22-c33b-324sd2c3f5",
"amount": 10,
"accountID": "epayment.KZ",
"currency": "KZT",
"email": "email@gmail.com",
"description": "TEST p2p",
"reference": "306177717717",
"invoiceID": "000000001",
"intReference": "",
"terminalID": "c36b282f-6819-4d4f-85df-a4bdc8a8f703",
"senderCardID": "",
"senderCardPAN": "",
"senderCardType": "",
"senderTransferType": "",
"senderCardIssuer": "",
"receiverCardID": "",
"receiverCardPAN": "",
"receiverCardType": "",
"receiverTransferType": "",
"receiverCardIssuer": "",
"secure": false,
"reason": "Restricted card",
"reasonCode": "489",
"name": "",
"phone": "",
"datetime": "2023-03-02T14:50:36.397155787+06:00",
"status": "error",
"data": "",
"post_link": "https://epay.homebank.kz/payform",
"failure_post_link": "https://testmerchant/order/000000001/fail",
"p2pType": "OCT"
}