NAV Navbar
swift

Introduction

Welcome to Aspire Ios SDK Documentation, use this SDK Integration Documentation to start your payment with Aspire Payment Gateway.

Transaction Flow

Transactionflow

  1. Checkout, When customer doing checkout in merchant's ios apps, the apps will send Request Transaction to merchant's server.
  2. Request Transaction, After receiving request from apps, merchant server will send Request Transaction to Aspire API.
  3. Get Request Transaction, Merchant server receive response from Aspire that cointains transaction detail.
  4. Response, Merchant server send the response back to customer's ios apps.
  5. Callback Notification, Aspire will send callback notification to merchant's server.

Environment

The standard IDE for application development for iOS apps is Xcode, version 9 above. For the project details, these are the minimum specifications:

This documentation also contains:

Integration

Import Aspire SDK Library To Merchant Apps

Import Aspire SDK Library to your pod file

IOS SDK Cocoapods Version

pod 'duitku', '~> 1.0'

Installation IOS SDK Cocoapods

import Duitku SDK Class

import duitku

Initializing class

class yourclass : DuitkuClient

Include Function To Respond Callback Transaction

override func onSuccess_(status: String, reference: String, amount: String, code: String, merchantOrderId: String) {
    //logic here    
    clearSdkTask()
}

override func onPending_(status: String, reference: String, amount: String, code: String, merchantOrderId: String) {
    //logic here    
    clearSdkTask()
}

override func onCanceled_(status: String, reference: String, amount: String, code: String, merchantOrderId: String) {
    //logic here    
    clearSdkTask()
}

There are 3 different function in catch callback situation.
Merchant will need to create 3 pages to show the customers about ther transaction status. 

On viewWillAppear

override func viewWillAppear(_ animated: Bool) {
      runPayment(self)

      self.navigationController?.isNavigationBarHidden = false
      self.navigationItem.title = "Order" //optional

}

Request Transaction To Merchant Server

Add Method For RequestTransaction To Merchant Server

func settingMerchant(){

    Util.merchantNotification = true

    DuitkuKit.data(
          paymentAmount: "100000" //example //your payment amount 
         ,productDetails: "Test Pay with duitku" // 
         ,email: "[email protected]" //your email 
         ,phoneNumber: "08123456789" //your customer phone number
         ,additionalParam: "" //optional 
         ,merchantUserInfo: "" //optional
         ,customerVaName: "John Doe"  // display name on bank confirmation display
         ,callbackUrl: 'http://example.com/callback'; // url for callback
         ,returnUrl: 'http://example.com/return'; // url for return
         ,expiryPeriod: "10" // set the expired time in minutes
         ,firstName: "john"
         ,lastName: "doe"
         ,alamat: "Jl. Kembangan Raya"
         ,city: "jakarta"
         ,postalCode: "11530"
         ,countryCode: "ID"
         ,merchantOrderId: "" //can empty if merchant order id on web server
    )

    //can loop here
    ItemDetails.data(name: "sepatu" , price: 100000 , quantity: 1) //optional


     // base url
    BaseRequestDuitku.data(
          baseUrlPayment: "http://server-merchant/api/" //base url merchant server
         ,requestTransaction: "requestTransaksi.php" //endpoint
         ,checkTransaction: "checktransaksi.php" //endpoint
         ,listPayment: "listPayment.php" //endpoint
     )


}

Function Description
Util.merchantNotification Set notification from Duitku or from Merchant. Set value to true to use merchant notification page, or false to use duitku notification page.
runPayment(self) Run Duitku SDK.
paymentAmount Amount of transaction.
productDetails Product detail of transaction.
email Customer's email address, this field is mandatory.
phoneNumber Customer's phone number, this field is mandatory.
additionalParam Additional parameter for merchant purpose.
merchantUserInfo Merchant user info or Customer info.
customerVaName Name that will be shown in VA so customer can see their name in mobile banking or ATM machine, this field is used only by VA payment channel.
expiryPeriod Expiry time of the transaction in minutes.(max: 1440)
callbackUrl Merchant callback url, this must be linked to merchant server to update the status of transaction.
returnUrl Merchant return url, this must be linked to merchant server to redirect customer to merchant page after finished or cancelled their payment.
baseUrlPayment Merchant site url to access request transaction module, check transaction module and List Payment module.
requestTransaction Request transaction module on merchant server.
checkTransaction Check transaction module on merchant server.
listPayment List of payment method module on merchant server.

Start Payment Function

Call StartPayment Function

startPayment(self);

Merchant need to call startPayment() Function to continue the payment process.

Merchant's Server Side

Below are sample of merchant server module to do transaction with Duitku IOS SDK

Description Value
Merchant Server Base URL Example, https://www.merchantsite.com
Request Transaction download
Check Transaction download
Payment List download

Error Handling

Getting Webkitview Exception

If you encounter this error exception, you need to import webkit framework to your target app

Getting Navigation Controller Exception

If you encounter this error exception, you need to add navigation controller to your view controller

Getting Blank When checkout payment

add these script on your info.plist file to prevent getting a blank page

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

Merchant Server Side

These are sample of merchant server module to do transaction with Duitku Ios SDK

Description Value
Merchant Server Base URL Example, https://www.merchantsite.com
Request Transaction download
Check Transaction download
Payment List download

Sample Ios Project

Sample project Sample-project