I noticed Paypal Android SDK added an option to add custom or invoice to PaypalPayment since v2.5.0. I am now able to add a item to PaypalPayment along with a custom value, something like this:
PayPalPayment payment = new PayPalPayment(new BigDecimal("1.75"), "USD", "sample item",
            PayPalPayment.PAYMENT_INTENT_SALE);
payment.custom("my custom value");
However, it is not mentioned in their documentation how to recover this custom value in onActivityResult. Here is my code:
    @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            if (requestCode == REQUEST_CODE_PAYMENT) {
                if (resultCode == Activity.RESULT_OK) {
                    PaymentConfirmation confirm = data
                            .getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
                    if (confirm != null) {
                        try {
//How do I get `custom` from `confirm` object here???
                            Log.e(TAG, confirm.toJSONObject().toString(4));
                            Log.e(TAG, confirm.getPayment().toJSONObject()
                                    .toString(4));
                            String paymentId = confirm.toJSONObject()
                                    .getJSONObject("response").getString("id");
                            String payment_client = confirm.getPayment()
                                    .toJSONObject().toString();
                            Log.e(TAG, "paymentId: " + paymentId
                                    + ", payment_json: " + payment_client);
                            //Payment verification logic
                        } catch (JSONException e) {
                            Log.e(TAG, "Meow! Coders ye be warned: ",e);
                        }
                    }
                } else if (resultCode == Activity.RESULT_CANCELED) {
                    Log.e(TAG, "The user canceled.");
                } else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) {
                    Log.e(TAG,"Invalid Payment");
                }
            }
        }
Even if I use invoice number instead of custom, there doesn't seem any method available to retrieve from PaymentConfirmation object, nor its method PaypalPayment
 
     
    