Get Transaction Id / Code after Payment Intent Call

Hi, i was making a test on payment intent:
This is the code for launch intent:

Locale locale = new Locale("it", "IT");
String currencyCode = NumberFormat.getCurrencyInstance(locale).getCurrency().getCurrencyCode();

Payment payment = new Payment();
String referenceId = UUID.randomUUID().toString();
payment.setAmount(amount);
payment.setCurrency(currencyCode);

// start Payment activity for result
try {
       Intent collectPaymentIntent = new Intent(Intents.ACTION_COLLECT_PAYMENT);
       collectPaymentIntent.putExtra(Intents.INTENT_EXTRAS_PAYMENT, payment);
       startActivityForResult(collectPaymentIntent, COLLECT_PAYMENT_REQUEST);
 } catch (ActivityNotFoundException ex) {
       Log.e(TAG, "Poynt Payment Activity not found - did you install PoyntServices?", ex);
 }

After complete the payment i need confirmation about success, but also the transaction number.
I need to get the transaction id/number, but i don’t put this data in the Payment object.
I know that this seems to be strange but for the purpose of the app that i am developing, it’s needed to obtain a transaction number from the “outside”.

This is the onActivityResult function code:

   @Override
        public void onActivityResult(int requestCode, int resultCode, Intent data) {
            try {
                super.onActivityResult(requestCode, resultCode, data);

                if (requestCode == COLLECT_PAYMENT_REQUEST) {

                    if (resultCode == Activity.RESULT_OK) {
                        if (data != null) {
                            Payment payment = data.getParcelableExtra(Intents.INTENT_EXTRAS_PAYMENT);
                            Log.d(TAG, "Received onPaymentAction from PaymentFragment w/ Status("
                                    + payment.getStatus() + ")");
                            if (payment.getStatus().equals(PaymentStatus.COMPLETED)) {
                                Toast.makeText(this, "Payment Completed", Toast.LENGTH_LONG).show();
                                if(data.getExtras() != null){
                                    if(data.getExtras().get(Intents.INTENT_EXTRAS_TRANSACTION_ID) != null){

                                        String TransactionCode = data.getExtras().get(Intents.INTENT_EXTRAS_TRANSACTION_ID).toString();
                                        
                                    }

                                }
                            } else if (payment.getStatus().equals(PaymentStatus.AUTHORIZED)) {
                                Toast.makeText(this, "Payment Authorized", Toast.LENGTH_LONG).show();
                            } else if (payment.getStatus().equals(PaymentStatus.CANCELED)) {
                                Toast.makeText(this, "Payment Canceled", Toast.LENGTH_LONG).show();
                            } else if (payment.getStatus().equals(PaymentStatus.FAILED)) {
                                Toast.makeText(this, "Payment Failed", Toast.LENGTH_LONG).show();
                            } else if (payment.getStatus().equals(PaymentStatus.REFUNDED)) {
                                Toast.makeText(this, "Payment Refunded", Toast.LENGTH_LONG).show();
                            } else if (payment.getStatus().equals(PaymentStatus.VOIDED)) {
                                Toast.makeText(this, "Payment Voided", Toast.LENGTH_LONG).show();
                            } else {
                                Toast.makeText(this, "Payment No Status", Toast.LENGTH_LONG).show();

                            }
                        }
                    } else if (resultCode == Activity.RESULT_CANCELED) {
                        Toast.makeText(this, "Payment Canceled", Toast.LENGTH_LONG).show();
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

In detail data.getExtras().get(Intents.INTENT_EXTRAS_TRANSACTION_ID)
return null and this is my problem.

There is another way to obtain transaction id/number after payment intent?
For example a transaction number generated by the Smartpos itself and related to the merchant transactions register.

Alternatively, if I insert a transaction number for each payment, then there is a way for the merchant to extract the list of all the transactions made in that SmartPos and from there to identify those made through my app?

Hi,
In the response the transaction ID is part of the payment object that you receive as an extra in the intent result
payment.getTransactions().get(0).getId()
Note there can be multiple transactions for a payment, getTransactions() returns a list and each transaction will have a unique ID

I wanted to know even if there is a register of all the transactions made in the smartpos (even from other apps). Is there a register of this type?

The transactions are stored in transactions content provider on the terminal

Thank you for the answer.
It’s possible for the merchant to access this transaction list from his web panel?
For example from the Poynt Mission Control panel I see all the transactions of a merchant: can the merchant also see this list? … can he download an excel / csv report from his dashboard?
My final goal is to make the merchant to consult this list and download a report (i don’t need to download this list from my app itself).

Yes the merchant can view and export reports from their portal