Developer's Guide
Mobile Payments Library Developer Guide & Reference – Blackberry OS Edition 11
PayPalBlackberryLibraryPayPalPaymentDelegateException {
UiApplication.getUiApplication().invokeLater(new
Runnable() {
public void run() {
Dialog.alert("payment cancelled");
UiApplication.getUiApplication(). pushScreen(new
DemoAppScreen());
}}
);
}}
The following are the callback events triggered in the PayPalPaymentDelegate interface:
Method Description
paymentCancelled
The payment was cancelled by the user.
paymentFailed(String errorId,
The payment failed for the reason specified by error ID &
String errorMessage) message.
paymentIncompleted
The payment was incomplete.
paymentCompleted
The payment was successfully completed.
The PreapprovalDelegate is used in conjuncture with preapproval payments. The
following callback events are triggered in the PreapprovalDelegate interface:
Method Description
preapprovalCancelled
The preapproval was cancelled by the user.
paymentFailed(String errorId,
The preapproval failed for the reason specified by error ID
String errorMessage) & message.
preapprovalCompleted(String
The preapproval was successfully completed.
preapprovalKey)
Dynamic Amount Calculation
The Mobile Payments Library allows you to dynamically modify the payment information any
time a buyer selects a shipping address. For instance, you might want to recalculate the tax
amount based on the buyer’s location.
To enable this, use the optional method
setDynamicAmountCalculationEnabled()
(see “Optional Methods” below). You must provide the logic that creates the new payment
values based on the buyer’s address. The library includes a
PaymentAdjuster
class for
this.
To use this feature, one of your classes must implement “PaymentAdjuster”, as well as
implement “Serializable”. For simplicity, we recommend creating a new class that does
this. This class must include the following methods:
public Amounts adjustAmount(Address address, String currency,
BigDecimal amount, BigDecimal tax, BigDecimal shipping);