Mobile Integration

On this page


Apple Pay is only available on iOS devices with support for PassKit.

Xcode Setup

Before offering Apple Pay in your app, you first need to activate your Merchant ID within your project settings by following this guide: Apple Pay in Xcode.


You can follow Offering Apple Pay in Your App to implement Apple Pay within your app.

Payment Authorization

When the user authorizes the payment using Face ID or Touch ID on their iOS device, the didAuthorizePayment event will be dispatched. In this step you need to post the paymentData to Moyasar found within PKPayment object. Here is an example:

struct ApplePaySource: Codable {
    var type = "applepay"
    var token: String

struct PaymentRequest: Codable {
    var amount: Int
    var description: String
    var publishable_api_key: String
    var source: ApplePaySource

let payment: PKPayment = // Payment object we got in the didAuthorizePayment event
let source = ApplePaySource(token: String(data: payment.token.paymentData, encoding: .utf8))
let request = PaymentRequest(
    amount: 100, // 100 Halalas == SAR 1.00
    description: "iOS Apple Pay Payment",
    publishable_api_key: "pk_live_12345",
    source: source)

Now you need to serialize the request object as JSON and send it to Moyasar API like it was described in Web Integration.

More Resources

For more resources on Apple Pay development, please visit Apple Developer Documentation.

Please visit the Acceptable Use Guidelines for more information about what Apple Pay may be used for and the Human Interface Guidelines.

Last Modified : Sep 2021