Preapproval Process using PayPal MPL in Android

1 Comment


The objective of the document is to explain the steps involved in doing auto renewal payment in PayPal using its Mobile Payment library for android mobile.

Steps to get confirmed PreApproval Key

  1. The first step towards integrating PayPal with android application is that we need a PayPal sandbox account for testing. So create new sandbox account if you don’t have one from following URL
  2. Sign in with the user id and password.
  3. Create Test accounts for both buyer and seller. You will get the API credential while creating seller account, those API credential will be used for getting preapproval key and payments.
  4. From your Local server send the preapproval request to paypal using the following parameters. You should use your account details and API credentials here.
    1. requestUrl:
    2. requestMethod: POST
    3. requestBody: requestEnvelope.errorLanguage=en_US&cancelUrl= buyer mail id
  5. If the above process and parameters are correct you will get a Preapproval key from server as response.
  6. Response:{“responseEnvelope”:{“timestamp”:”2011-09-21T02:54:44.020-07:00″,”ack”:”Success”,”correlationId”:”606efc1b8abb0″,”build”:”2142261″},”preapprovalKey”:”PA-81Y46219NL419022F”}
  7. This Preapproval Key say PA-81Y46219NL419022F has to authorize by the application. Pass the Preapproval key and merchant name to PayPal MPL from your android application. Here we used “SimpleDemo” android application given by the PayPal MPL library for understanding purpose.
  8. The Mobile User should login and agree the PayPal preapproval payment. After the user agreement the preapproval key get authorized and return back to the application.

Steps to make Payment

From your Local server by using the authorized preapproval key you can make a payment using the following parameters.

  1. requestUrl:
  2. requestMethod: POST
  3. requestBody: requestEnvelope.errorLanguage=en_US&actionType=PAY&preapprovalKey= Authorized preapproval key&receiverList.receiver(0).amount=30.00&receiverList.receiver(0).email=your seller mail id┬ĄcyCode=USD&feesPayer=EACHRECEIVER&memo=Simple payment example.&cancelUrl=http://your_cancel_url&returnUrl=http://your_return_url&ipnNotificationUrl=http://your_ipn_notification_url

If the above parameters are correct the amount mentioned in the “receiver(0).amount=” column will get transferred to the seller account and you will get a Pay Key as response from the PayPal server. You can login in to both seller and buyer account to ensure the above process.


PayPal Integration in iPhone and Android

Leave a comment

I was curious to know if PayPal would support Credit card Payment using their Mobile library for iPhone and Android. But finally I got to know the fact from a PayPal guy that we can not just do a checkout only with credit card details. We always need a paypal account to checkout.

The good thing with PayPal is that they have officially launched the Mobile Library for iPhone and Android, otherwise developers would have a high time, getting the trust of the users and crossing the big Apple’s Approval process gate. It could have better if their library directly supports the Credit card only checkout.

Let us hope that, they bring that feature sooner.