Payment widget
When registered, you will be given data, that is needed when making the payment:
TerminalID | Store identification |
ClientID | Client Identification |
ClientSecret | Secret Key |
Receiving a token for payment processing
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: "payment" client_id: "ClientID" client_secret: "ClientSecret" invoiceID: "Номер заказа" amount: 100 curency: "KZT" terminal: "TerminalID"
Field | Description |
---|---|
grant_type | Authorization type, client_credentials used to process payment |
scope | Resource |
client_id | Merchand Identification. Can be retrieved on the merchant account page, initially received when registering. |
client_secret | Merchant access key. Can be retrieved on the merchant account page, initially received when registering. |
invoiceID | Order number. Generated by the merchant. Must be unique for every new order |
amount | Order amount |
curency | Transaction currency |
terminal | Salespoint identification. Can be retrieved on the merchant account page. Initially generated when registered. |
Response
{
"access_token":"DCEB8O_ZM5U7SO_T_U5EJQ",
"expires_in": 7200,
"refresh_token":"",
"scope":"payment",
"token_type":"Bearer"
}
Field | Description |
---|---|
access_token | A token that is used for payment processing. |
expires_in | Expiry period of a token |
refresh_token | Not used with this type of authorization |
scope | Resource, payment type used for payment authorization |
token_type | Authorization type |
Calling Widge
You need to connect a JS-Library on a page and make a call to halyk.showPaymentWidget().
URL: https://test-epay.homebank.kz/payform/payment-api.js
You must pass these parameters when calling halyk.showPaymentWidget(createPaymentObject(auth, invoiceId, amount), callBk)
var createPaymentObject = function(auth, invoiceId, amount) { var paymentObject = { invoiceId: "Номер заказа", 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: "Оплата в интернет магазине", accountId: "testuser1", terminal: "TerminalID", amount: 100, currency: "KZT" }; paymentObject.auth = auth; return paymentObject; }; halyk.showPaymentWidget(createPaymentObject(auth, invoiceId, amount), callBk);
Field | Description |
---|---|
invoiceId | Order number. Generated by the merchant. Must be unique for every new order |
backLink | Link to get back to the store when payment succeeds. |
failureBackLink | Link to get back to the store when payment fails. |
postLink | Notification about the payment success. |
failurePostLink | Notification about the payment failure. If not given, information would be sent back to the address that is specified in postLink. |
language | Language |
description | Order description |
accountId | Option field fir client identification number |
terminal | Store identification |
amount | Order amount |
currency | Order currency |
auth | Authorization token |
callBk | send back the object { success: true | false } |
halyk.showPaymentWidget()
{ success: true | false }
Post link
The message would be sent to the URL that is specified in postLink field
In case of success:
{
"amount": 100,
"currency": "KZT",
"reference": "109600746891"
"approvalСode": "730190",
"code": 0,
"secure": "No",
"accountId": "testuser1",
"invoiceId": "3274327489"
}
In case of failure:
{
"accountId": "testuser1",
"invoiceId": "3274327489"
"amount": 100,
"currency": "KZT",
"code": -1,
"message": "dublicate transaction"
}