question

igor-yazovtsev avatar image
igor-yazovtsev asked sam Deactivated answered

receive Refund for custom payment

Hello! How receive "refund request" for my custom payment (gift) application? Where can I see an example?

Refund
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

sam avatar image
sam Deactivated answered

Make sure you're handling refund intent:

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

Your refund intent activity will be given:

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();

Please refer to this thread: https://devask.clover.com/question/62...

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