Developer's Guide

Mobile Payments Library Developer Guide and Reference –iOS Edition August 2012 13
There are two delegate functions, one for Simple Payments and one for Advanced Payments:
-(PayPalAmounts *)adjustAmountsForAddress:(PayPalAddress const
*)inAddress andCurrency:(NSString const *)inCurrency
andAmount:(NSDecimalNumber const *)inAmount andTax:(NSDecimalNumber
const *)inTax andShipping:(NSDecimalNumber const *)inShipping
andErrorCode:(PayPalAmountErrorCode *)outErrorCode;
-(NSMutableArray *)adjustAmountsAdvancedForAddress:(PayPalAddress const
*)inAddress andCurrency:(NSString const *)inCurrency
andReceiverAmounts:(NSMutableArray *)recieverAmounts
andErrorCode:(PayPalAmountErrorCode *)outErrorCode;
NOTE: If an error occurs during dynamic amount calculation, you can notify the library using the
outErrorCode parameter of either of the above delegate methods to report the error to the
library. You would do this using code similar to the following:
*outErrorCode = AMOUNT_ERROR_OTHER;
The possible values for the outErrorCode parameter are as follows:
Parameter Value Description
AMOUNT_ERROR_NONE
This is the default value for the error parameter, and indicates that no
error occurred.
AMOUNT_ERROR_SERVER
If you set
outErrorCode to this value, the library displays a fatal
error indicating that a network error occurred and allows the buyer to
return to your app.
AMOUNT_ERROR_OTHER
If you set
outErrorCode to this value, the library displays a fatal
error with a generic error message and allows the buyer to return to
your app.
Delegate Methods in the Mobile Payments Library
NOTE: Due to an issue with buyers choosing to exit the application as soon as they saw the
Success screen, the
PayPalPaymentDelegate (formerly PayPalMEPDelegate) protocol has
been updated.
paymentSuccess Method
This method is called as soon as the library completes a payment or preapproval. The payKey is
a unique identifier for the payment, while
paymentStatus is an enumerated type which can be
STATUS_COMPLETED, STATUS_CREATED, or STATUS_OTHER. The merchant app should store
the fact that the payment succeeded (for later display) and perform any desired bookkeeping at
this point, such as tracking the payment on a merchant-controlled server, but should not perform
any user interface updates. If the transaction is a preapproval, the preapproval key is returned in
place of the
payKey.
-(void)paymentSuccessWithKey:(NSString *)payKey
andStatus:(PayPalPaymentStatus)paymentStatus;