Developer's Guide
12 July 2011 PayPal Mobile Payments Developer Guide and Reference – Android OS Edition
Parameter
Description
style:
(Required) Size and appearance of the Pay with PayPal button
Allowable values are:
PayPal.BUTTON_152x33
PayPal.BUTTON_194x37
PayPal.BUTTON_278x43
PayPal.BUTTON_294x45
For images of the different button types, see “Enumerated Values in the
Mobile Payments Library” on page 28.
context:
(Required) The context
textType:
(Required) The type of button to be used. The type will determine the
text that is to be used on the button. This has no bearing on the payment
and only affects the button itself. Allowable values are:
CheckoutButton.TEXT_PAY
CheckoutButton.TEXT_DONATE
Start the Library Activity
The Library uses the native Android Activity mechanism to start the checkout flow, and to
communicate completion back to you. In addition to the onActivityResult callback, you can
implement PayPalResultDelegate to be informed immediately upon successful completion of
a payment.
To start the PayPal payment, you must start the Library activity, using the Android method
startActivityForResult. Do this when buyers touch the Pay with PayPal button (which
you placed on your page with the getCheckoutButton method)
You must first create the PayPal intent and give it the Payment object. There are two types of
payment objects. PayPalPayment handles simple payments, which support single receivers of
payments with one transaction and a few details. PayPalAdvancedPayment handles parallel
and chained payments, which support multiple receivers of payment with one transaction and
with additional details, such as invoice data.
In the following example, the buyer checks out with a simple payment for a single recipient:
PayPalPayment newPayment = new PayPalPayment();
newPayment.setSubtotal(10.f);
newPayment.setCurrency("USD");
newPayment.setRecipient("my@email.com");
newPayment.setMerchantName("My Company");
Intent paypalIntent = PayPal.getInstance().checkout(newPayment, this);
this.startActivityForResult(paypalIntent, 1);