According to paypal's documentation you can pay orders and something like that but I don't know if it's possible to send this kind of request using Android SDK (link below):
curl -v -X POST https://api.sandbox.paypal.com/v1/checkout/orders \
-H "Content-Type: application/json" \
-H "Authorization: Bearer Access-Token" \
-H "PayPal-Partner-Attribution-Id: EXAMPLE_MP" \
-d '{
"purchase_units": [
{
"reference_id": "store_mobile_world_order_1234",
"description": "Mobile World Store order-1234",
"amount": {
"currency": "USD",
"details": {
"subtotal": "1.09",
"shipping": "0.02",
"tax": "0.33"
},
"total": "1.44"
},
"payee": {
"email": "[email protected]"
},
"items": [
{
"name": "NeoPhone",
"sku": "sku03",
"price": "0.54",
"currency": "USD",
"quantity": "1"
},
{
"name": "Fitness Watch",
"sku": "sku04",
"price": "0.55",
"currency": "USD",
"quantity": "1"
}
],
"shipping_address": {
"line1": "2211 N First Street",
"line2": "Building 17",
"city": "San Jose",
"country_code": "US",
"postal_code": "95131",
"state": "CA",
"phone": "(123) 456-7890"
},
"shipping_method": "United Postal Service",
"partner_fee_details": {
"receiver": {
"email": "[email protected]"
},
"amount": {
"value": "0.01",
"currency": "USD"
}
},
"payment_linked_group": 1,
"custom": "custom_value_2388",
"invoice_number": "invoice_number_2388",
"payment_descriptor": "Payment Mobile World"
}
],
"redirect_urls": {
"return_url": "https://example.com/return",
"cancel_url": "https://example.com/cancel"
}
}'
Ps. It seems like getStuffToBuy()
(line 83) could make this request but I'm not really sure if it's possible to make it
purchase_units: [
{
reference_id: another field,
description: 'Hello World',
amount: {
currency_code: 'MXN',
value: "100.00"
}
}
]
Android SDK:
PayPal's Documentation:
https://developer.paypal.com/docs/api/orders/v1/
Thanks a lot!
That Android SDK is deprecated and will be end of life [December 2020]
If you want a native SDK for processing PayPal payments, use Express Checkout via the Braintree SDK
For authentication, use a sandbox access token from the bottom of https://www.paypal.com/signin?intent=developer&returnUri=https%3A%2F%2Fdeveloper.paypal.com%2Fdeveloper%2Fapplications on your server, and return a client token to your client. (production access token, https://www.paypal.com/api )
Do not create a Braintree gateway account, nor use gateway credentials from braintreegateway.com . Do not use a tokenization key.
Native Checkout is now available in some countries, notably US and Europe: https://developer.paypal.com/docs/business/native-checkout/
For non-native payments, the orders v1 documentation you linked to should also not be used. Use orders v2, https://developer.paypal.com/docs/checkout/reference/server-integration/