question

jahnold avatar image
jahnold asked jahnold commented

Refunding an Order using the Android SDK

Hi Clover,

I'm trying to refund an Order using the Android SDK. I'm getting my Order:

Order order = orderConnector.getOrder(orderId);

I'm constructing a refund as:

Refund refund = new Refund();
refund.setAmount(order.getTotal());

I've tried both of:

orderConnector.refund(orderId, refund);
orderConnector.addRefund(orderId, refund);

But every time I get an exception

com.clover.sdk.v1.ForbiddenException: App doesn't have required permission

I can confirm that the App has all permissions granted in the App console and I have uninstalled/reinstalled several times to ensure that the permissions are being pulled through correctly.

Are you actually able to add refunds to an order using the SDK or would we need to use the REST API? (I know this is the case for adding payments for instance). Or is there something wrong with the way I'm constructing the Refund (does it have to be linked to a specific payment?)

Refund
3 comments
10 |2000

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

Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·

Only Clover apps can perform refund. I will try to find out why.

0 Likes 0 ·
chrisjholly avatar image chrisjholly commented ·

Does clover apps include refunding from through the rest API too?

I need to make sure that if an order is placed and paid for that the transaction is cancelled the the payment transaction is cancelled.

0 Likes 0 ·
jahnold avatar image jahnold commented ·

Thanks Mike

0 Likes 0 ·

1 Answer

Mike M avatar image
Mike M answered

Refunding via both Rest API and SDK is not possible. It is locked down for 3rd party developers due to the possibility of it enabling full-on theft, among other security concerns.

You will need to provide messaging to the merchant to notify them of any cancelled transactions and have them manually refund lineitems or an entire order via the Orders app. Please see the action Intents.ACTION_START_ORDER_MANAGE in the Clover Android SDK for information on how to start the order manage screen for a given order.

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