question

Jai avatar image
Jai asked ·

Custom tender full payment

image description

In Clover Custom Tenders documentation, they have described that custom tender must pay for entire order . This statement will not be feasible for our custom tender business logic.

So is it a mandatory to follow the documentation and if yes can I know the logic behind it?

Thanks,

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.

Mark Mullan avatar image
Mark Mullan answered ·

Good question. It is possible to make a partial payment using a custom tender like @brokenOval mentioned, when the merchant is on the Register plan. From the Merchant facing experience, for example, the implementation is fairly straightforward, and is as you would imagine. If the payment POSTs successfully on your end, then tell Clover everything went well:

Intent data = new Intent();

data.putExtra(Intents.EXTRA_AMOUNT, amount);
data.putExtra(Intents.EXTRA_CLIENT_ID, "Your_external_payment_ID");

setResult(RESULT_OK, data);
finish();

This is the easy part. The more difficult piece you'll need to account for are refunds on partial payments made by custom tenders. Let me explain. LineItem-level refunds using Custom tenders are possible (i.e., they are not all-or-nothing). First ensure your custom tender's Refund Activity can handle refund Intents:

<intent-filter>
    <action android:name="clover.intent.action.REFUND" />
    <category android:name="android.intent.category.DEFAULT" />

From your refund activity, capture some Extras from the refund Intent:

final long amount = getIntent().getLongExtra(Intents.EXTRA_AMOUNT, 0);
final String orderId = getIntent().getStringExtra(Intents.EXTRA_ORDER_ID);
final String paymentId = getIntent().getStringExtra(Intents.EXTRA_PAYMENT_ID);
final ArrayList<String> lineItemIds = getIntent().getStringArrayListExtra(Intents.EXTRA_LINE_ITEM_IDS);

If the Refund POSTs successfully on your end, tell Clover everything went as planned:

Intent data = new Intent();

data.putExtra(Intents.EXTRA_ORDER_ID, orderId);
data.putExtra(Intents.EXTRA_PAYMENT_ID, paymentId);
data.putExtra(Intents.EXTRA_LINE_ITEM_IDS, lineItemIds);
data.putExtra(Intents.EXTRA_AMOUNT, amount);
data.putExtra(Intents.EXTRA_CLIENT_ID, "Your_external_payment_ID");

setResult(RESULT_OK, data);
finish();

Else:

setResult(RESULT_CANCELED, data);
finish();

There is a major caveat to this feature in its current state. When a lineItem-level, custom tender refund Intent is fired, the EXTRA_AMOUNT is the sum of the lineItems.amounts that were selected. As such, the EXTRA_AMOUNT might be greater than the amount that was paid for using the custom tender. For Orders on which the refund's EXTRA_AMOUNT <= the custom tender payment, everything will work as intended. However, you'll still need to add logic to verify this and handle cases where the custom tender was applied as a partial payment, and pass back the appropriate EXTRA_AMOUNT to Clover before finish()-ing. I'm looking into possibly implementing a change on Clover's end to address this current state. But in the meantime, you'll need to account for these scenarios.

I realize the caveat bullet point, in particular, is dense. Please let me know if you'd like any clarification - I'm happy to explain.

The caveat bullet point is also ?highly? important. Gift cards are, not surprisingly, the number 1 source for partial payments to occur (e.g., apply the remaining $3 of your gift card to an order, pay for the rest of the balance due with your cc), so it's not an uncommon occurrence you'll want to account for.

Best, Mark

1 comment 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.

Thanks Mark

0 Likes 0 · ·
brokenOval avatar image
brokenOval answered ·

It is certainly possible to do a partial payment with a custom tender - I have seen this in action and the merchant is prompted to "Add another payment" - whether its recommended is another issue.

Bearing in mind, the payment mechanism changes depending on the hardware & plan set up i.e. if the Merchant has a Full Plan with station etc (using the Register App), partial payments are allowed. However if the Merchant is on the Terminal Only plan (using a mini and the simple payment/ Sales app) - only full payments can be taken.

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.

So is it mandatory to pay full order or not?

0 Likes 0 · ·

Not mandatory if on Register Full Plan.

1 Like 1 · ·

Per @brokenOval, yes it's possible if the merchant is on a plan that supports the Register app. It's not possible otherwise. The Register / Payments app flow allows for paying partially. The Sale app does not.

0 Likes 0 · ·

Welcome to the
Clover Developer Community