# Download DirectPay iOS SDK

Click to Download SDK

# Specifications

  • DirectPay Mobile SDK (iOS): 1.0

  • Deployment Target: 11

  • Language: Swift 4.2

# Installation (XCode)

  1. Right click on the project and choose "Add Files to 'project name' ".
  2. Browser and select DPSDK.framework and click "Add".

# Usage

# 1.1 Create DPSDK instance

let directpay: DPSDK = DPSDK(apiKey: "API_KEY",
    dpMerchantId: "YOUR_MERCHANT_KEY",
    uniqueUserId: "USER_ID",
    userName: "USER_NAME",
    mobile: "+94731234567",
    email: "emailifavailable@user.com")
1
2
3
4
5
6

# 1.2 Add Credit/Debit Card

self.directpay.addCard(self, success: { (card) in
            print("[NEW CARD ADDED] SUCCESS - CARD_DETAILS: ", card)
            // your code here
}, error: {(code:String, message:String) in
            print("[NEW CARD ADDING FAILED] ERROR: CODE - ",code, "MESSAGE - ", message)
})
1
2
3
4
5
6

# Sample Project


# Error Codes

Error callback - error(code, message)

Code Message
567 CANNOT_VERIFY_THE_REQUEST
568 CANNOT_PROCESS
569 INVALID_SERVER_RESPONSE
570 SERVICE_UNAVAILABLE
571 INTERNAL_ERROR
600 USER_ACTION_CLOSE
601 TOO_LARGE_RETRY_ATTEMPTS