Developer's Guide
Mobile Payments Library Developer Guide & Reference – Blackberry OS Edition 18
Preapprovals
The PayPal Mobile Payments Library lets you set up and obtain authorization in advance from
buyers for future payments to you without requiring buyers to authorize each payment
individually. For example, you might use the library to establish preapproval agreements for
subscriptions to mobile content, such as mobile streaming audio or video. Or, you might use the
library to establish preapproval agreements for payments to gain access to higher levels of
difficulty in mobile games.
How Preapprovals Work
There are 3 steps to setting up and using preapprovals.
1. Obtain a pending preapproval key from PayPal.
From your application, create a
PreapprovalPayment
object and a
PreapprovalRequest
object with the terms of your preapproval agreement.
2. Obtain authorization from the buyer for the preapproval agreement.
Obtain the preapproval key and set it with the
setPreapprovalKey
method. After
this is set, invoke the Preapproval flow by calling the method
preapprove
method of
the PayPal instance, passing it objects that implement the
PreapprovalPayment
and
PreapprovalRequest
. The library launches the preapproval checkout experience
and, if it is processed successfully, the preapprovalSucceeded method is called.
If the processing fails, the preapprovalFailed method is invoked.
3. Take payments from the buyer under the terms of the preapproval agreement.
From your web server, send a
Pay
request to PayPal with the buyer’s confirmed
preapproval key.
For more information about the
Preapproval
and
Pay
requests, see the Adaptive Payments
Developer Guide.
About Preapproval Keys
Preapproval keys uniquely identify your preapproval agreements. Preapproval keys that you
obtain by using the
Preapproval
API identify your pending preapproval agreements. No buyers
have yet agreed to them. Pending approval keys remain valid for 3 hours before expiring without
confirmation from buyers.
To launch the preapproval checkout experience to confirm a buyer’s agreement to a pending
preapproval, set the preapproval key in the PayPal instance using the setPreapprovalKey
method. This preapproval key is retuned if the buyer completes the preapproval checkout.
Maintain a record of buyers and their confirmed preapproval keys on your web server. Later on
your web server, take payments from buyers by sending
Pay
requests with buyers’ preapproval
keys to PayPal.