Before initializing the payment page, you need to install the SDK in your mobile application.
iOS SDK installation instructions
Android SDK installation instructions
SDK Payment Page Launch Instructions
After configuring the SDK in your mobile application, proceed to configure the payment itself.
When launching the payment page, depending on your settings, the following types of payments will be available to the customer:
- Payment by Bank Card
- HalykQR Payment
- Installment/Credit Purchase
- MasterPass
- iOS Specific
- Apple Pay
- Android Specific
- Google Pay
- Samsung Pay
- Saved Cards in Homebank (available only for the Halyk ecosystem systems)
To enable/disable a specific type of payment, please contact your manager.
1. Initializing an Invoice Instance
Before proceeding to the payment page, initialize an instance of the Invoice model.
Description of common fields.
Field name | Required | Description |
---|---|---|
id (invoiceId) | Yes | 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, uniqueness must also be maintained for the last 6 characters. |
amount | Yes | Order Amount |
currency | Yes | Currency |
postLink | Yes | Payment notification |
failurePostLink | Yes | Failed payment notification, if not filled out, the information will be sent to the address specified in postLink |
backLink | Yes | Return link to the store in case of successful payment |
failureBackLink | Yes | Return link to the store in case of unsuccessful payment |
description | Yes | Order description, maximum 125 bytes |
isRecurrent | Yes | true to set up a recurring payment, otherwise false. By default, we recommend using false |
autoPaymentFrequency | No | Payment frequency: WEEKLY, MONTHLY, QUARTERLY |
homebankToken | No | For the possibility of payment with cards saved in the Homebank |
accountId | No | Optional field for specifying the customer's store identifier |
Example of initializing an Invoice instance in iOS
To initialize the payment Invoice, you need to pass transferType=nil
import EpaySDK
let invoice = Invoice(
id: invoiceId,
amount: amount,
currency: "KZT",
accountId: "1",
description: "",
postLink: "https://testmerchant/order/1123",
failurePostLink: "https://testmerchant/order/1123/fail",
isRecurrent: false,
autoPaymentFrequency: .weekly
)
Example of initializing an Invoice instance in Android
import com.ss.halykepay.data.model.Invoice
val invoice = Invoice(
id = invoiceId,
amount = amount,
currency = "KZT",
accountID = "1",
description = "",
postLink = "https://testmerchant/order/1123",
failurePostLink = "https://testmerchant/order/1123/fail",
isRecurrent = false,
autoPaymentFrequency = Invoice.AutoPaymentFrequency.WEEKLY
)
2. Launching payment page
iOS Example
import EpaySDK
let pm = PaymentModel(authConfig: <Previously configured AuthConfig>, invoice: <Invoice instance created by paragraph above>)
let launchScreenVC = LaunchScreenViewController(paymentModel: pm)
launchScreenVC.setEnvironmetType(type: .prod) //for test .dev
navigationController?.pushViewController(launchScreenVC, animated: true)
Android Example
Using the previously created instance of HalykEpaySDK, launch the payment page by passing the instance of Invoice. halykEpaySdk.launchEpay(invoice)
## 3. MasterPass
MasterPass works as follows:
1. The merchant's application receives a session, the customer's card token
2. Passes data to the SDK for payment by Masterpass
3. The client performs an action in the SDK and makes a payment
### Initializing payment by Masterpass iOS
```JSON
import EpaySDK
masterPass = MasterPassData(
cardData: MasterPassCardData(
token: "BC0B67F5F218414C8DC7AFF47ED33893",
CardHolder: "JON JONSON",
ExpiryDate: "04/24",
PANMask: "440563...5096",
CardStatus: 1),
merchantName: "Kcell",
session: "372d7003-fff1-4ba8-99e3-55a11532ece5",
masterPassAction: MasterPassAction(
SaveCard: false,
updateSaveCard: false,
recurring: false)
)
let invoice = Invoice(
id: invoiceId,
amount: amount,
currency: "KZT",
accountId: "1",
description: "",
postLink: "https://testmerchant/order/1123",
failurePostLink: "https://testmerchant/order/1123/fail",
isRecurrent: false,
autoPaymentFrequency: .weekly,
masterPass: masterPass
)
Initializing payment by Masterpass Android
import com.ss.halykepay.data.model.Invoice
import com.ss.halykepay.data.model.MasterPass
import com.ss.halykepay.data.model.MasterPassAction
import com.ss.halykepay.data.model.MasterPassCardData
masterPass = MasterPass(
cardData = MasterPassCardData(
token = "BC0B67F5F218414C8DC7AFF47ED33893",
CardHolder = "JON JONSON",
ExpiryDate = "04/24",
PANMask = "440563...5096",
CardStatus = 1),
merchantName = "Kcell",
session = "372d7003-fff1-4ba8-99e3-55a11532ece5",
MasterPassAction = MasterPassAction(
SaveCard = false,
updateSaveCard = false,
recurring = false)
)
val invoice = Invoice(
id = invoiceId,
amount = amount,
currency = "KZT",
accountID = "1",
description = "",
postLink = "https://testmerchant/order/1123",
failurePostLink = "https://testmerchant/order/1123/fail",
isRecurrent = false,
autoPaymentFrequency = Invoice.AutoPaymentFrequency.WEEKLY,
masterPass = masterPass
)