2012
16 January 2011 PayPal Mobile Express Checkout Library Developer Guide and Reference
Sample Code
The sample code in this section comes from sample application code included with the download
of Mobile Express Checkout Library. Get the download of the library from x.com/mobile.
Library Header File
The library header file, PayPal.h, includes the following definitions.
#import <UIKit/UIKit.h>
...
Use the following protocol to implement your own delegate class. Your class receives device
tokens from the library when your code attempts to fetch a device token.
@protocol DeviceReferenceTokenDelegate <NSObject>
@required
- (void)receivedDeviceReferenceToken:(NSString *)token;
- (void)couldNotFetchDeviceReferenceToken; @end
Use the following interface to access features of the Mobile Express Checkout Library.
@interface PayPal : NSObject <UIWebViewDelegate> {
@private
BOOL initialized; //whether the PayPal object is initialized.
BOOL paymentsEnabled;
NSString *appID;
NSString *lang;
PayPalEnvironment environment;
NSString *errorMessage;
NSMutableArray *payButtons;
id<DeviceReferenceTokenDelegate> delegate;
}
@property (nonatomic, retain) NSString *lang;
@property (nonatomic, retain) NSString *errorMessage;
@property (nonatomic, retain) NSMutableArray *payButtons;
@property (nonatomic, readonly) NSString *appID;
@property (nonatomic, readonly) BOOL initialized;
@property (nonatomic, readonly) BOOL paymentsEnabled;
@property (nonatomic, readonly) PayPalEnvironment environment;
+ (PayPal*)getInstance;
- (void)fetchDeviceReferenceTokenWithAppID:(NSString const *)inAppID
forEnvironment:(PayPalEnvironment)env
withDelegate:(id<DeviceReferenceTokenDelegate>)del;
- (void)fetchDeviceReferenceTokenWithAppID:(NSString const *)inAppID
withDelegate:(id<DeviceReferenceTokenDelegate>)del;