P2P REDIRECT TO FORM
During registration, you will be given the data that you will need to use when making the payment:
TerminalID | Store ID |
ClientID | Client ID |
ClientSecret | Secret key |
Before starting to connect to the ePay system, the merchant needs to create a button that will perform the transition function when pressed, let's call uf.p2p
In turn, this button will generate InvoiceID.
Test merchant
url | https://test-epay.homebank.kz |
epay@halykbank.kz | |
password | XZG1E@Mm |
ClientID | test |
ClientSecret | yF587AV9Ms94qN2QShFzVR3vFnWkhjbAK3sG |
TerminalID | 3ad0f5bd-88a8-464c-a9a4-cdb16d1dd31 |
Test payment card
PAN | Expire Date | CVC | Status |
---|---|---|---|
4405639704015096 | 01/25 | 815 | unlock |
5522042705066736 | 01/25 | 525 | unlock |
377514500004820 | 01/25 | 4169 | unlock |
4003032704547597 | 09/20 | 170 | lock |
5578342710750560 | 09/20 | 254 | lock |
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 ```js grant_type: "client_credentials" scope: "transfer" client_id: "test" client_secret: "yF587AV9Ms94qN2QShFzVR3vFnWkhjbAK3sG" terminal: "67e34d63-102f-4bd1-898e-370781d0074d" secret_hash: "JDKCNDDGGDTPSKJD"
Field | Description |
---|---|
grant_type | Authorization type, the client_credentials |
scope | Resource |
client_id | Merchant ID, can be obtained in the cabinet, issued during registration |
client_secret | The merchant's access key, which can be obtained in the cabinet, is issued upon registration |
terminal | The ID of the point of sale, which can be obtained in the cabinet, is issued during registration |
secret_hash | additional secret value(string) generated by the online store system which will be returned to Postlink |
Response
{
"access_token":"DCEB8O_ZM5U7SO_T_U5EJQ",
"expires_in": 7200,
"refresh_token":"",
"scope":"transfer",
"token_type":"Bearer"
}
Field | Description |
---|---|
access_token | Token for the operation |
expires_in | Token expiration time |
refresh_token | Not used for this type of authorization |
scope | Resource, a resource is used for making a payment |
token_type | Authorization type |
Redirection to the payment 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.p2p() 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: "RU", description: "Payment in the online store", accountId: "testuser1", terminal: "40a348cb-68a3-45d5-9002-a4836d79c3b5", amount: 100, currency: "KZT", phone: "77777777777", email: "example@example.com" cardSave: true //The parameter must be passed as Boolean }; paymentObject.auth = auth; return paymentObject; }; halyk.pay(createPaymentObject(auth, invoiceId, amount));
Field | Description |
---|---|
invoiceId | The order number generated by the merchant must be unique for each new order, only numbers from 6 to 15 characters |
backLink | Link to return to the store with a successful payment |
failureBackLink | Link to return to the store in case of a failed payment |
postLink | Payment Notification |
failurePostLink | Notification of a failed payment, if not filled in, the information will be sent to the address specified in the postLink |
language | Language |
description | Order Description |
accountId | Optional field for specifying the store's customer ID |
terminal | Store ID |
amount | Order amount |
currency | Currency |
phone | customer's phone number (optional) |
customer's email (optional) | |
cardSave | saving the map |
auth | Token / is transmitted completely as an object, all data received from epay at the request of the token |
Postlink
A message will be sent to the specified URL specified in the postLink field.
Response if successful:
``json { "id": "ffffffff-0000-000f-f000-00f0000f000f", "dateTime": "2020-01-01T00:00:00.00000+06:00", " InvoiceID": "10000000001", "amount": 100, "currency": "KZT", "terminal": "67e34d63-102f-4bd1-898e-370781d0074d", "AccountId": "1", "description": "Payment in the online store", "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](https://developer.homebank.kz/epay/kody-oshibok )
### Response in case of failure:
```json
{
"id": "ffffffff-0000-000f-f000-00f0000f000f",
"dateTime": "2020-01-01T00:00:00.00000+06:00",
"invoiceId": "10000000001",
"amount": 100,
"currency": "KZT",
"terminal": "67e34d63-102f-4bd1-898e-370781d0074d",
"accountId": "1",
"description": "Payment in an online store",
"language": "RU",
"cardMask": "4444...4444",
"CardType": "",
"issuer": "Halyk bank",
"reference": "",
"secure": "yes",
"tokenRecipient": "",
"code": "error",
"reason": "error description",
"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
}