Skip to content

xendit/xendit-sdk-ios-src

Repository files navigation

Xendit iOS SDK

Xendit iOS SDK is compatible with CocoaPods and Swift Package Manager, and provides target for consumption: Xendit.

Ownership

Team: Credit Cards Team

Slack Channel: #p-cards-product

Slack Mentions: @troops-cards

Usage

Note that starting version 3.10.0, it requires minimum version of iOS 11. If you still want to support iOS 9, you may use version 3.9.2 instead.

Install Xendit iOS SDK with CocoaPods

Add this to your Podfile.

pod 'Xendit', '~> 3.10.0'

Important: Import SDK in Objective-C project with CocoaPods integration, you can do as following

#import "Xendit-Swift.h"

Install Xendit iOS SDK with SPM

  1. Select your project in the Project Navigator on the right. Select the project in the Project section and click the Package Dependencies tab at the top.

  2. Click the + button at the bottom of the table to add Xendit iOS SDK using the Swift Package Manager.

Screenshot 2022-03-15 at 2 10 14 PM

  1. Enter the package URL in the search field in the top right, that simply means the GitHub URL.

  2. Choose Dependency Rule as Up to Next Major Version from 3.7.0.

Screenshot 2022-03-15 at 10 11 26 PM

Screenshot 2022-03-15 at 10 13 34 PM

Important: Import SDK in Objective-C project with SPM integration, you can do as following

@import Xendit;

Creating token

This function accepts parameters below:

Parameter Type Description
Card Card Object Card data that will be used to create a token
amount String Amount that will be used to create a token bundled with 3DS authentication
shouldAuthenticate Boolean A flag indicating if 3DS authentication is required for this token. Will be set to true if you omit the parameter
isMultipleUse Boolean A flag to identify whether a token will be reusable or just for one-time use. Will be set to false if you omit the parameter
billingDetails billingDetails Object Card holder's billing details
customer customer object Xendit customer object
currency String Currency of the transaction that will be submitted for 3DS authentication
midLabel String For switcher merchant only Specific string value which labels any of your Merchant IDs (MID) set up with Xendit. This can be configured in the list of MIDs on your Dashboard settings. (If this is not included in a request, and you have more than 1 MID in your list, the transaction will proceed using your prioritized MID (first MID on your list)).

Running Tests

Running Tests from Xcode

Open Xendit.xcworkspace

To run unit tests: choose Xendit scheme and press cmd+u (or "Run Product" -> "Test")

To run UI tests: choose XenditExample scheme and press cmd+u

Run the app

Running App with Xcode

  1. Open xcode, click on the Open a project or file

Screen Shot 2020-12-08 at 11 17 45

  1. Browse to the repository folder, and open Xendit.xcworkspace

Screen Shot 2020-12-08 at 11 18 18

  1. Click the project scheme button (its beside stop button)

Screen Shot 2020-12-08 at 11 23 22

  1. A dropdown list will appear, click Edit scheme...

Screen Shot 2020-12-08 at 11 24 26

  1. On the Run section, at the Info tab, click the Executable dropdown

Screen Shot 2020-12-08 at 11 28 21

  1. Select XenditExample.app and Close the window

Screen Shot 2020-12-08 at 11 30 31

  1. Click the Run button

Screen Shot 2020-12-08 at 11 32 29

  1. Wait for the app build and the simulator will showed up

Screen Shot 2020-12-08 at 11 34 43