Developer's Guide

Mobile Payments Library Developer Guide and Reference –iOS Edition August 2012 33
currentPayment.invoiceData = [[[PayPalInvoiceData
alloc] init] autorelease];
currentPayment.invoiceData.totalTax = [NSDecimalNumber
decimalNumberWithString: @”1.00”];
currentPayment.invoiceData.totalShipping = [NSDecimalNumber
decimalNumberWithString: @”2.00”];
The PayPalPayment object is created and the properties are set.
After the
checkout method is called, the library releases the currentPayment object.
Checking Out
[ppMEP checkoutWithPayment:currentPayment];
The payment object is passed through to the library. The library displays itself on top of the
application’s
Window object, so be sure that you do not take control of the Window after the
checkout call is invoked.
Handling the Callback
-(void)paymentSuccessWithKey:(NSString *)payKey
andStatus:(PayPalPaymentStatus)paymentStatus;
This method is called as soon as the library completes a payment or preapproval. You could use
this message to trigger your own background bookkeeping. This message occurs while the library
is still using the device display, so your application should wait to do any user interface actions
until it receives the
paymentLibraryExit message.
-(void)paymentCanceled
This method is called as soon as the buyer cancels the transaction. As with the
paymentSuccess callback, your application should perform no user interface updates until it
receives the
paymentLibraryExit message.
-(void)paymentFailedWithCorrelationID:(NSString *)correlationID
errorCode:(NSString *)errorCode errorMessage:(NSString
*)errorMessage;
This method is called immediately upon failure of the payment, and you could do background
bookkeeping at this point. However, you should wait until you receive the
paymentLibraryExit method before doing any user interface updates.
-(void)paymentLibraryExit;
This method is called when the library is finished with the device display and is returning control
to the merchant app. The merchant app should handle displaying the payment status
(success/failed/canceled) to the buyer at this point.