question

dhana avatar image
dhana asked Raymond Lee Deactivated edited

how to show TIPS screen in Custom tender App ?

Hi Team,

Can anyone Suggest me how to implement Tips screen in Custom tender App ?

Thanks in Advance
Custom Tenders
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Raymond Lee avatar image
Raymond Lee Deactivated answered Raymond Lee Deactivated edited
Note that if your custom tender is a customer facing custom tender, it will show up in the Secure Pay app, in which case the tips screen is already shown by the Secure Pay app, and added to the order before your custom tender button will show up.

If you are trying to show the tips screen for your merchant facing tender, you can call the ACTION_CUSTOMER_ADD_TIP intent in your custom tender activity to bring up the tips screen, and retrieve the amount selected by the customer. You should then pass this amount as an EXTRA_TIP_AMOUNT into the result data of your merchant facing custom tender.

Here is some sample code:

Inside your MerchantTenderActivity.java:
final long orderAmount = getIntent().getLongExtra(Intents.EXTRA_AMOUNT, 0);
final String orderId = getIntent().getStringExtra(Intents.EXTRA_ORDER_ID);

Intent intent = new Intent(Intents.ACTION_CUSTOMER_ADD_TIP);
intent.putExtra(Intents.EXTRA_ORDER_ID, orderId);
intent.putExtra(Intents.EXTRA_AMOUNT, orderAmount); // needs to be type long

startActivityForResult(intent, tipRequestCode); // Set a unique request code so you know the result is from this request.
<br>@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == tipRequestCode){
        long tipAmount = data.getLongExtra(Intents.EXTRA_TIP_AMOUNT, 0);

        Intent data = new Intent();
        data.putExtra(Intents.EXTRA_AMOUNT, orderAmount);
        data.putExtra(Intents.EXTRA_TAX_AMOUNT, taxAmount);
        data.putExtra(Intents.EXTRA_TIP_AMOUNT, tipAmount);
        data.putExtra(Intents.EXTRA_NOTE, paymentNote);

        setResult(RESULT_OK, data);
        finish();
    }
}

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community