Skip to content
logo
  • Products
    • Amwal Checkout
    • Merchant App
    • Merchant Control Panel
  • Pricing
  • Developers
  • About us
  • Contact Us
Sign In
BA Booking

BA Booking

2
  • BA Booking overview
  • BA Booking Installation
amwalpay woocommerce

Woocommerce

2
  • Overview
  • Woocommerce Installation
CS-Cart

CS Cart

2
  • CS-Cart Overview
  • CS CART Installation
Shopify

Shopify

2
  • Shopify Overview
  • Shopify Installation
odoo

Odoo

2
  • Odoo Overview
  • Odoo Installation
whmcs

WHMCS

2
  • WHMCS Overview
  • WHMCS Installation
Magento

Magento

2
  • Magento 2 Overview
  • Magento Installation
Opencart

Opencart

2
  • OpenCart Overview
  • Opencart Installtion
ZenCart

ZenCart

2
  • ZenCart Overview
  • Zencart Installation
Drupal

Drupal

2
  • Drupal Overview
  • Drupal Installation
PrestaShop

PrestaShop

2
  • PrestaShop Overview
  • PrestaShop Installation
Contact Form 7

Contact Form 7

2
  • Contact Form 7 Overview
  • Contact Form 7 Installation
Joomla

Joomla

2
  • Joomla Overview
  • Joomla Installation
AMWAL INTEGRATED PAYMENT LINK

Amwal Integrated Payment Link

3
  • Introduction
  • Example Code
  • Response and Hash Generation
Android SDk

Native Android SDK

3
  • Pre Requisites
  • Implementation
  • SecureHash Calculation
ios SDk

Native iOS SDK

3
  • Pre Requisites
  • Implementation
  • SecureHash Calculation
React SDk

React Native SDK

2
  • Installation
  • Configuration

AmwalPay Laravel Package

2
  • Installation
  • Configuration

SMARTBOX

3
  • Pre Requisites
  • Implementation
  • SecureHash Calculation
View Categories
  • Home
  • Developer | Amwalpay
  • AmwalPay Mobile SDKs
  • Native iOS SDK
  • Implementation

Implementation

  1. Import the SDK in your Swift file:
import amwalsdk

2. Configure the payment parameters:

// First, fetch the session token
let networkClient = NetworkClient()
networkClient.fetchSessionToken(
    env: .UAT,  // Available options: .UAT, .PROD, .SIT
    merchantId: "YOUR_MERCHANT_ID",
    customerId: nil,  // Optional, only needed for saved card functionality
    secureHashValue: "YOUR_SECURE_HASH"
) { sessionToken in
    if let token = sessionToken {
        // Create the configuration with the session token
        let config = Config(
            environment: .UAT,  // Available options: .UAT, .PROD, .SIT
            sessionToken: token,
            currency: .OMR,     // Available options: .OMR, .USD, etc.
            amount: "AMOUNT",
            merchantId: "YOUR_MERCHANT_ID",
            terminalId: "YOUR_TERMINAL_ID",
            locale: .en,        // Available options: .en, .ar
            transactionType: .nfc,  // Available options: .nfc, .cardWallet, .applePay
            transactionId: Config.generateTransactionId(),  // Optional: Auto-generated if nil
            additionValues: Config.generateDefaultAdditionValues()  // Optional: Custom key-value pairs
        )
        
        // Initialize and present the payment SDK
        let sdk = AmwalSDK()
        let viewController = try sdk.createViewController(
            config: config,
            onResponse: { response in
                // Handle the payment response
                print("Payment Response: \(response ?? "No response")")
            },
            onCustomerId: { customerId in
                // Handle the customer ID if needed
                print("Customer ID: \(customerId)")
            }
        )
        
        // Present the view controller
        self.present(viewController, animated: true)
    } else {
        print("Failed to fetch session token")
    }
}

3. For SwiftUI applications, use the SDKViewControllerRepresentable:

struct PaymentView: View {
    var body: some View {
        SDKViewControllerRepresentable(
            config: config,
            onResponse: { response in
                // Handle the payment response
                print("Payment Response: \(response ?? "No response")")
            },
            onCustomerId: { customerId in
                // Handle the customer ID if needed
                print("Customer ID: \(customerId)")
            }
        )
    }
}

Getting the SDK Session Token and Calculation of Secure Hash to call the API

Endpoint to Fetch SDKSessionToken

Environment URLs #

Stage #

  • Base URL: https://test.amwalpg.com:14443
  • Endpoint: Membership/GetSDKSessionToken

Production #

  • Base URL: https://webhook.amwalpg.com
  • Endpoint: Membership/GetSDKSessionToken

Description #

This endpoint retrieves the SDK session token.

Headers #

Header : Content-Type
Value : application/json

Sample Request #

{
  "merchantId": 22914,
  "customerId": "ed520b67-80b2-4e1a-9b86-34208da10e53",
  "requestDateTime": "2025-02-16T12:43:51Z",
  "secureHashValue": "AFCEA6D0D29909E6ED5900F543739975B17AABA66CF2C89BBCCD9382A0BC6DD7"
}

Sample Response #

{
  "success": true,
  "message": "Success",
  "data": {
    "sessionToken": "eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0..3yAPVR3evEwvIdq808M2uQ..."
  }
}
Updated on August 26, 2025

What are your Feelings

  • Happy
  • Normal
  • Sad

Share This Article :

  • Facebook
  • X
  • LinkedIn
  • Pinterest
Pre RequisitesSecureHash Calculation
Table of Contents
  • Environment URLs
    • Stage
    • Production
    • Description
    • Headers
  • Sample Request
  • Sample Response

Secure. Seamless – Powering Payments for Every Business.

Sign Up
Support

4th Floor, Majan Tower Building
North Al Ghubrah, P.O. Box 233, P.C 118
Muscat, Sultanate of Oman

: support@amwal-pay.com

📞 : +96824121845

Resources
  • Developers
  • Careers
Company
  • About us
  • Contact Us
  • Contact Sales
  • Partners

2025 © AmwalPay. All Rights Reserved.

  • Terms & Conditions
  • Privacy Policy