Skip to content
Mukesh Patil - Sr. iOS Engineer edited this page Jan 27, 2017 · 9 revisions

Integration Guide

Samples

See the Objective-C Example app and Swift Example app for a working implementation of all API methods.

Note: make sure to open the project using CitrusPay.xcworkspace and not CitrusPay.xcodeproj for Cocoa-Pod Example. To run the example project, run pod install from the Example directory first.

Initializing the SDK

  • Complete the installation steps (above).

Swift

  • Include CitrusPay
import CitrusPay

Objective-C

  • Include CitrusPay.h
#import <CitrusPay/CitrusPay.h>

####Setup working Enviroments

SDK operates in two different modes Sandbox and Production mode. for both the enviroments Citrus PG Prerequisites key sets are different. keys from one enviroment won't work on other. so please make sure you are using correct set of keys. During the developement you would always want to use the Sandbox mode. once you are done with your App development you can switch to production mode .

Swift

#if PRODUCTION_MODE
CitrusPaymentSDK.initWithSign(inID: SignInId, signInSecret: SignInSecretKey, signUpID: SubscriptionId, signUpSecret: SubscriptionSecretKey, vanityUrl: VanityUrl, environment: CTSEnvProduction)
#else
CitrusPaymentSDK.initWithSign(inID: SignInId, signInSecret: SignInSecretKey, signUpID: SubscriptionId, signUpSecret: SubscriptionSecretKey, vanityUrl: VanityUrl, environment: CTSEnvSandbox)
#endif

Objective-C

#if PRODUCTION_MODE
[CitrusPaymentSDK initWithSignInID: SignInId signInSecret: SignInSecretKey signUpID: SubscriptionId signUpSecret: SubscriptionSecretKey vanityUrl: VanityUrl environment: CTSEnvProduction];
#else
[CitrusPaymentSDK initWithSignInID: SignInId signInSecret: SignInSecretKey signUpID: SubscriptionId signUpSecret: SubscriptionSecretKey vanityUrl: VanityUrl environment: CTSEnvSandbox];
#endif

Only after you are done with initialization you can proceed with following guide

The SDK is logically divided into 3 modules/layers or interfacing classes

  • CTSAuthLayer - handles all of the user creation related tasks .
  • CTSProfileLayer - handles all of the user profile related tasks .
  • CTSPaymentLayer - handles all of the payment related tasks .

To use any of the above layers your need to fetch their singlton instance from CitrusPaymentSDK's class methods,

Swift

// initialization in your .m file
var authLayer : CTSAuthLayer?
var profileLayer : CTSProfileLayer?
var paymentLayer : CTSPaymentLayer?

authLayer = CTSAuthLayer.fetchShared()
profileLayer = CTSProfileLayer.fetchShared()
paymentLayer = CTSPaymentLayer.fetchShared()

Objective-C

// initialization in your .m file
CTSAuthLayer * authLayer = [CTSAuthLayer fetchSharedAuthLayer];
CTSProfileLayer * proifleLayer = [CTSProfileLayer fetchSharedProfileLayer];
CTSPaymentLayer * paymentLayer = [CTSPaymentLayer fetchSharedPaymentLayer];

Set Logger Level ( By Default it's None )

Swift

CitrusPaymentSDK.setLogLevel(.verbose)

Objective-C

[CitrusPaymentSDK setLogLevel:CTSLogLevelVerbose];

Get the Card's Schemes & Bank Logo Images

Following are the specific tasks related to each of the layer

#Important Update for iOS 9

#####Doing direct payments

#####User Management

#####Card Management

#####Using Citrus Cash a.k.a Prepaid Account

#####Dynamic Pricing Offer Coupons and Surcharge

#####One Tap Payment

#####Others

===== ####Common Integration Issues

#Important Instructions for the Releasing to Apple

Clone this wiki locally