sumup/sumup-android-sdk

How to define or find out if the transaction was credit or debit?

keisyd opened this issue · 1 comments

Request

  • Can I choose credit or debit by the customer bypassing the Solo UI?
  • Can I find out which one was choosen by the UI?

The problem

My system needs to persist for my customers the payment type choosen by the payer.
I couldn't find a way to setup, before the SumUpAPI.checkout(this, payment, 2);, a way to choose the payment type (credit or debit) programmatically. Neither could I tell which one was choosen on the Solo UI by the response. As far as I can tell. The whole response is (the extras from the intent response):

Bundle[{tx-info=TransactionInfo{card=Card{last4Digits='1694', type='ELO'}, products=[Product{name='Test', price=20.0, quantity=1}], transactionCode='TCHQS9UN4L', foreignTransactionId='null', merchantCode='M2GUM74X', amount=20.0, tipAmount=0.0, vatAmount=0.0, currency='BRL', status='FAILED', paymentType='POS', entryMode='contactless', installments=1}, smp-tx-code=TCHQS9UN4L, smp-receipt-sent=false, smp-result-code=2, smp-message=Transaction failed.}]

I'm using the version:

implementation 'com.sumup:merchant-sdk:5.0.1'

The code for the request is:

  public boolean checkout(String amount, String title, String currencyCode) {
    SumUpPayment payment = SumUpPayment.builder()
            .total(new BigDecimal(amount))
            .currency(SumUpPayment.Currency.valueOf(currencyCode))
            .title(title)
            .build();
    SumUpAPI.prepareForCheckout();
    SumUpAPI.checkout(this, payment, 2);
    return true;
  }

And the response handling is:

 @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == 2 && data != null) {
      Bundle extra = data.getExtras();
      Integer resCode = extra.getInt(SumUpAPI.Response.RESULT_CODE);
      String resMessage = extra.getString(SumUpAPI.Response.MESSAGE);
      String resTxCode = extra.getString(SumUpAPI.Response.TX_CODE);
      boolean resReceiptSent = data.getExtras().getBoolean(SumUpAPI.Response.RECEIPT_SENT);

      Log.d("resCode == 1", "data");
    }
  }

Hello
Unfortunately not at the moment, as we have some technical constraints. However, we are working on a solution that would enable the integrators to be able to programmatically input credit/debit (and also installments). This is not being actively worked on so cannot provide any estimation.