This library is a wrapper for PayPal MPL SDK. Note that currently PayPal is migrating to a new SDK named Mobile SDK. The Mobile SDK is a different SDK and is only supported in the US.
PayPal MPL is considered part of PayPal Classic API and is based on the Adaptive API.
Currently only "Basic Payments" are supported.
Relevant links:
- PayPal MPL SDK:
https://github.com/paypal/sdk-packa...al_MPL_1.5.5.45_Android-Developer-Package.zip (click on the Raw button).
You should download this zip file and copy PayPal_MPL.Jar from the MPL Library folder to Basic4android libraries folder.
- PayPal Java guide:
https://developer.paypal.com/webapps/developer/docs/classic/mobile/ht_mpl-itemPayment-Android/
- Sandbox accounts:
https://developer.paypal.com/webapps/developer/applications/accounts
It is quite simple to accept payments with PayPal library.
For example:
Sub Globals
Dim pp As PayPal
End Sub
Sub Activity_Create(FirstTime As Boolean)
pp.Initialize("APP-80W284485P519543T", True, "paypal")
End Sub
Sub PayPal_Ready (Success As Boolean)
Log("Ready: " & Success)
If Success Then
Activity.AddView(pp.GetPayPalButton(True), 0, 0, 200dip, 100dip)
End If
End Sub
Sub PayPal_Click
pp.RequestPayment("USD", 100, "example-facilitator@domain.com", "My Company", _
pp.PAYMENT_TYPE_SERVICE)
End Sub
Sub PayPal_Result (Success As Boolean, Extra As String)
Log("Success: " & Success & ", Extra: " & Extra)
End Sub
The first step is to initialize the PayPal object.
The Ready event is raised when the service is ready. You should then add the PayPal button.
When the user clicks on this button we make a payment request. The user will be asked for his account details:
The Result event is raised when the payment is processed (or canceled).
Extra parameter will hold the transaction key or the error message (or "canceled" for canceled transactions).
The following code should be added to the manifest editor:
AddApplicationText(
<activity android:name="com.paypal.android.MEP.PayPalActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:configChanges="keyboardHidden|orientation"/>)
V1.00 - Fixes an issue with a missing permission.