Error getting custom id number using IPoyntCustomIDProviderService

Hi,
We are implementing set a custom ID to a transaction using:

private IPoyntCustomIDProviderService.Stub mBinder = new IPoyntCustomIDProviderService.Stub()
{
    @Override
    public void getCustomIDReferences(Payment payment, String requestID, IPoyntCustomIDProviderServiceListener iPoyntCustomIDProviderServiceListener) throws RemoteException
        {
            List<TransactionReference> references = new ArrayList<>();

            TransactionReference reference1 = new TransactionReference();
            reference1.setCustomType("FISCAL_RECEIPT_ID");
            reference1.setType(TransactionReferenceType.CUSTOM);
            references.add(reference1);

            // . . . .
            // Do some implementation to fill ticketNumber
            // . . . .
            reference1.setId(ticketNumber);

            iPoyntCustomIDProviderServiceListener.onResult(requestID, references);
        }
}

When we fill ticketNumber locally we don’t have problems, but when try fillins from a services we are having the ploblem tha the Payment is already closed.

To get the ticketNumber we send a broadcast that the service get and return the value of ticketNumber with another broadcast, the we do de setting and the the call to onResult, but we can see in the log that payment is already closed.
The service have not lunch an activity (we see that looks like a problem), just make a sleep and return a fixed value. Also the time is not the problem because when we do internally take more time that calling the external service.
What caould be wrong in this situation? When Poynt decide to close the payment?

Thanks, greetings