Payment Gateway Compliance & Information
If the STC Pay integration between Ottu and STC Pay has been completed, the Checkout SDK will automatically handle the necessary checks to display the STC Pay button seamlessly.
When the Checkout SDK is initialized with the session_id and payment gateway codes (pg_codes), the SDK will verify the following conditions:
The
session_id
andpg_codes
provided during initialization must be associated with the STC Pay Payment Service. This ensures that the STC Pay option is available for the customer.In the Android SDK, the STC Pay button is displayed regardless of whether the customer has entered a mobile number while creating the transaction.
Due to compliance requirements, for iOS, the KNET payment gateway requires a popup notification displaying the payment result after each failed payment. This notification is triggered only in the cancelCallback, but only if a response is received from the payment gateway.
As a result, the user cannot retry the payment without manually clicking on Apple Pay again.
To properly handle the KNET popup notification, the following Swift code snippet must be implemented into the payment processing flow:
func cancelCallback(_ data: [String: Any]?) {
var message = ""
if let paymentGatewayInfo = data?["payment_gateway_info"] as? [String: Any],
let pgName = paymentGatewayInfo["pg_name"] as? String,
pgName == "kpay" {
message = paymentGatewayInfo["pg_response"].debugDescription
} else {
message = data?.debugDescription ?? ""
}
navigationController?.popViewController(animated: true)
let alert = UIAlertController(
title: "Cancel",
message: message,
preferredStyle: .alert
)
alert.addAction(UIAlertAction(title: "OK", style: .cancel))
self.present(alert, animated: true)
}
Function Breakdown
The above code performs the following checks and actions:
Checks if the
cancelCallback
object contains payment gateway informationIt verifies whether the
payment_gateway_info
field is available in the response.
Identifies if the payment gateway used is
KNET
It checks if the
pg_name
property equalskpay
, confirming that the transaction was processed using KNET.
Check the above two conditions are met by retrieving the payment gateway response
If the gateway response (
pg_response
) is available, it is displayed; otherwise, a default message (Payment was cancelled.
) is used.
Navigates back and displays an alert
The user is returned to the previous screen (
navigationController?.popViewController(animated: true)
).A popup notification is displayed using
self.present(alert, animated: true)
, informing the user about the failed payment.
This payment option enables direct payments through the mobile SDK. The SDK presents a user interface where the customer can enter their cardholder details (CHD). If supported by the backend, the user can also save the card for future payments—stored as a tokenized payment method.
The onsite checkout screen appears identical to the native platform version.
Android

iOS

The SDK supports multiple instances of onsite checkout payments. Therefore, for each payment method with a PG code equal to ottu_pg
, the card form (as shown above) will be displayed.
Android

iOS

Last updated