Difference between revisions of "IOS API Documentation"

From Cloud9 Payment Processing Gateway Documentation
Jump to: navigation, search
(Installation and Build)
(Library Search Paths)
Line 11: Line 11:
 
#'''target->Build Settings->Enable bitcode'''->No
 
#'''target->Build Settings->Enable bitcode'''->No
  
==Library Search Paths==
+
==Verify Search Paths==
Please, check that the library search paths were added correctly to project when ''Payment''' library was drag-and-dropped in step 3 above.
+
To avoid the Apple Linker Errors:<br>
If not, add these paths manually like so:<br>
+
#'''target->Build Settings->Library Search paths'''<br>* Path of the payment library - eg '''$(PROJECT_DIR)/CardTest/Payment'''<br>* Path of the react - eg '''$(PROJECT_DIR)/CardTest/Payment/React'''
;target->Build Settings->Library Search paths<br>:1.$(PROJECT_DIR)/CardTest/Payment<br>2.$(PROJECT_DIR)/CardTest/Payment/React
+
#'''target->Build Phases->Link Binary With Libraries'''<br>Add these files:<br>* Click + -> select libPayment.a (Payment/libPayment.a)<br>* Click + -> select libPaymentPhone.a (Payment/libPaymentPhone.a)<br>* Click + -> select libReact.a (Payment/React/libReact.a)
 +
#'''target->Build Phases->Copy Bundle Resources'''<br>Click + -> select main.jsbundle (Payment/include/main.jsbundle)
  
 
==Import==
 
==Import==

Revision as of 21:26, 26 September 2017




Cloud9 Payment Gateway Documentation. This site can also be reached at http://docs.cloud9paymentgateway.com

HTTP API Sample Screenshot

Download iOS SDK Library

Please use this link to download the library: iOS SDK Library

Installation and Build

  1. Unzip Payment.zip
  2. Copy Payment/ folder to project_root
  3. Open xcode and drag project_root/Payment/ folder to xcode project (select copy if needed)
  4. target->Build Settings->Other Linker Flags
    Add -Objc, -lc++, -all_load
  5. target->Build Settings->Enable bitcode->No

Verify Search Paths

To avoid the Apple Linker Errors:

  1. target->Build Settings->Library Search paths
    * Path of the payment library - eg $(PROJECT_DIR)/CardTest/Payment
    * Path of the react - eg $(PROJECT_DIR)/CardTest/Payment/React
  2. target->Build Phases->Link Binary With Libraries
    Add these files:
    * Click + -> select libPayment.a (Payment/libPayment.a)
    * Click + -> select libPaymentPhone.a (Payment/libPaymentPhone.a)
    * Click + -> select libReact.a (Payment/React/libReact.a)
  3. target->Build Phases->Copy Bundle Resources
    Click + -> select main.jsbundle (Payment/include/main.jsbundle)

Import

Import Payment.h in header file of UIViewController

//ViewController.h
#import "Payment.h"

Initialization

To initialize library functions, write below code in the implementation file

[[Payment sharedMySingleton] initializeReactView:self]

//ViewController.m
- (void)viewDidLoad {
    [super viewDidLoad];
    [[Payment sharedMySingleton] initializeReactView:self];
}

Usage

Request

NSMutableDictionary *data = [@{
                             @"apiCall":@{
                               @"url": @"https://testlink.c9pg.com:5551/hj",
                               @"method": @"POST",
                               @"data": @{
                                  @"GMID": @"1234",
                                  @"GTID": @"1234",
                                  @"GWPW": @"1234",
                                  @"MainAmt": @"123",
                                                   
                             }
                     }
                  } mutableCopy];
[[Payment sharedMySingleton] send:data];

Response

Response of api call will be received at onResponseCallback
Response object contains request and responseJson.

//ViewController.m 
- (void)onResponseCallback:(id)response {
    NSLog(@"%@", response);
    NSString *string = [NSString stringWithFormat:@"%@", [response objectForKey:@"responseJson"]];
    NSLog(@"%@", string);
}







From the makers of Cloud9 Payment Processing Gateway and Creditline Credit Card Processing Software