vhsg avatar image
vhsg asked ·

Discounts getting removed on order

This particular issue has been reported to us by a merchant.

1) A discount for amount $x is added to the order for $y by our app. Giving total order value $y-x
2) The merchant then closes out the sale with a card payment for $y-x
3) The card payment gets processed but it is for $y and the amount of $x is shown as still owed (as though it were a split tender)

It is as if the discount is getting rejected during the card processing. Do you have any idea why this might happen?
10 |2000 characters needed characters left characters exceeded

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

How is your app creating the discount? Android SDK or REST API.

0 Likes 0 · ·
Andrid SDK, this has been reported again
0 Likes 0 · ·

How is the card payment triggered? Is it opened from your app using Intents.ACTION_SECURE_PAY? Or does the merchant complete the sale outside your app's flow? When the payment is being made, is the total amount shown on Pay $y or $y-x? If the order total remains $y, it's likely the order object hasn't been updated with the new discount when the payment is requested.

0 Likes 0 · ·

1 Answer

vhsg avatar image
vhsg answered ·
our app does not start any payment process, it is started from the proper button AFTER the merchant is done with our app. We are changing the order's total, this is picked up by clover. After a merchant is done with our app he's back on the payment screen where the total is shown with the discount on it. The merchant confirms that they are seeing the discount applied at this stage.

When they accept payment, the payment is taken for part of the order and then the discount portion reappears as unpaid.

example: total order $50, we apply a $10 discount, Clover shows $40 total. Merchant goes to take a payment of $40, which goes through but then it shows that the customer still owes $10 (the discount) when really it should close the order.

However, we don't interact with the payment in any way.

After the payment is done we're catching onPaymentProcessed or Intents.ACTION_PAYMENT_PROCESSED and we're registering the order with our server.
3 comments Share
10 |2000 characters needed characters left characters exceeded

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

@vhsg, we're going to need a sample of your code to better understand what is happening here. We're unable to reproduce this issue on our own.

0 Likes 0 · ·

@vhsg It sounds like the discount object is not being added correctly onto the order object. If the discount amount is removed from the total but discount object doesn't exist on the order object, it will result in a partial payment since the full amount has not been paid off. I was able to add a discount to my order using this code snippet:

public void addDiscount(View view) {
new AsyncTask<Void, Void, Void>() {
OrderConnector OC = new OrderConnector (getBaseContext(), mAccount, null);

@Overrideprotected Void doInBackground(Void... voids) {
try {
Discount discount = new Discount();
discount.setName("test discount");
OC.addDiscount2("77HHVDRHQW2M6", discount);
} catch (Exception e) {
return null;

The resulting behavior is shown in this video:

0 Likes 0 · ·

We are using orderConnector.addDiscount instead of orderConnector.addDiscount2- is orderConnector.addDiscount not working?

Because our SDK need to maintain all backward functionality, you will sometimes see functions with names such as addDiscount2 which are newer functions that should be used in preference to older deprecated (but still operative) functions.

If it wasn't working I suspect it wouldn't work all the time, not just for 1 merchant, sometimes.

With single instance errors, our approach is to first achieve reproduction. This may require looking through this merchant crashalytics log to parse out where in the code might have failed. It may be helpful to paste a redacted error log to pinpoint the issue.

Also, our Order Connector is OrderV31Connector. OrderConnector or OrderV31Connector? addDiscount or addDiscount2? OrderConnector is a subclass of OrderV31Connector. Use OrderConnector unless you have a specific reason for using the older versions directly (eg. OrderV3Connector).

0 Likes 0 · ·

Welcome to the
Clover Developer Community