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:

  1. Payment by Bank Card
  2. HalykQR Payment
  3. Installment/Credit Purchase
  4. MasterPass
  5. iOS Specific
    1. Apple Pay
  6. Android Specific
    1. Google Pay
    2. Samsung Pay
  7. 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 nameRequiredDescription
id (invoiceId)YesOrder 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.
amountYesOrder Amount
currencyYesCurrency
postLinkYesPayment notification
failurePostLinkYesFailed payment notification, if not filled out, the information will be sent to the address specified in postLink
backLinkYesReturn link to the store in case of successful payment
failureBackLinkYesReturn link to the store in case of unsuccessful payment
descriptionYesOrder description, maximum 125 bytes
isRecurrentYestrue to set up a recurring payment, otherwise false. By default, we recommend using false
autoPaymentFrequencyNoPayment frequency: WEEKLY, MONTHLY, QUARTERLY
homebankTokenNoFor the possibility of payment with cards saved in the Homebank
accountIdNoOptional 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
    )