Saving a payment card

Upon 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
TerminalID67e34d63-102f-4bd1-898e-370781d0074d

Test payment card

PANExpire DateCVCStatus
440563970401509601/25815unlock
552204270506673601/25525unlock
37751450000482001/254169lock
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: 0
currency: "USD"
terminal: "67e34d63-102f-4bd1-898e-370781d0074d"
postLink: ""
failurePostLink: ""

FieldDescription
grant_typeAuthorization type, the client_credentials type is used for making a payment
scopeResource
client_idMerchant's ID, which can be obtained in the cabinet, is issued upon 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 a 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_tokenThe token for the operation
expires_inToken Expiration Time
refresh_tokenIt is not used for this type of authorization
scopeResource, the payment resource is used to make the payment
token_typeAuthorization type

Making a payment

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

Production version

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.cardverification() 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 /",
language: "rus",
description: "Card registration",
AccountId: "testuser1",
terminal: "67e34d63-102f-4bd1-898e-370781d0074d",
amount: 0,
currency: "USD",
cardSave: true,
PaymentType: "cardVerification"
};
       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 digits, then additionally uniqueness must be observed for the last 6 digits
backLinkLink to return to the store upon successful payment
failureBackLinkLink to return to the store in case of a failed payment
postLinkPayment Notification
languageLanguage rus/kaz/eng
descriptionOrder description, the allowed number of characters is 125 bytes
AccountIdField for specifying the store's customer ID, required field when saving the card (cardSave: true)
terminalThe store ID, which can be obtained in the cabinet, is issued upon registration
amountThe amount to save the card is always 0
currencyCurrency, always USD to save the card
cardSaveRequired parameter for saving the map, passed as boolean
PaymentTypeOperation type - card verification

Post link

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/status-tranzakcii )

Response in an event of success:

{
    "id": "ffffffff-0000-000f-f000-00f0000f000f",
    "dateTime": "2020-01-01T00:00:00.00000+06:00",
    "invoiceId": "10000000001",
    "invoiceIdAlt":"8564546",
    "amount": 0,
    "currency": "USD",
    "terminal": "67e34d63-102f-4bd1-898e-370781d0074d",
    "accountId": "1",
    "description": "Регистрация карты",
    "language": "RU",
    "cardMask": "4444...4444",
    "cardType": "",
    "issuer": "Halyk bank",
    "reference": "001111111111",
    "secure": "yes",
    "tokenRecipient": "",
    "code": "ok",
    "reason": "",
    "reasonCode": 0,
    "name": "CARD HOLDER",
    "email": "ch@example.kz",
    "phone": "77777777777",
    "ip": "5.188.155.135",
    "ipCountry": "Kazakhstan",
    "ipCity": "Almaty",
    "ipRegion": "",
    "ipDistrict": "",
    "ipLongitude": 76.9293,
    "ipLatitude": 43.2638,
    "cardId": "e7e2587f-de26-4f41-ae1f-80c1fea31728"
}

Error codes

Response in case of failure:

{
 "id": "ffffffff-0000-000f-f000-00f0000f000f",
 "dateTime": "2020-01-01T00:00:00.00000+06:00",
 "invoiceId": "10000000001",
 "amount": 0,
 "currency": "USD",
 "terminal": "999999999",
 "accountId": "1",
 "description": "Регистрация карты",
 "language": "RU",
 "cardMask": "4444...4444",
 "cardType": "",
 "issuer": "Halyk bank",
 "reference": "",
 "secure": "yes",
 "tokenRecipient": "",
 "code": "error",
 "reason": "описание ошибки",
 "reasonCode": -498,
 "name": "CARD HOLDER",
 "email": "ch@example.kz",
 "phone": "77777777777",
 "ip": "5.188.155.135",
 "ipCountry": "Kazakhstan",
 "ipCity": "Almaty",
 "ipRegion": "",
 "ipDistrict": "",
 "ipLongitude": 76.9293,
 "ipLatitude": 43.2638
}