question

Sukhbir Singh avatar image
Sukhbir Singh asked Sukhbir Singh answered

Urgent: Refund Issue with Payment connector

Hi @Jeffrey Blattman @David Marginian @Jacob Abrams,


We have integrated the updated clover SDK and passed the external reference Id along with the Sale request using Payment Connector, and it’s working as expected. But when we tried to refund that transaction by using below code we got following exceptions.


Code to send Refund request:

RefundPaymentRequest refund = new RefundPaymentRequest();
refund.setPaymentId(mRefundPayment.getPaymentId());
refund.setOrderId(mRefundPayment.getOrderId());
refund.setFullRefund(mRefundPayment.isFullPayment());
refund.setAmount(10L);
mPaymentConnector
.refundPayment(refund);


Exception seen in the Logcat:

02-06 02:50:10.769 680-704/? I/Timeline: Timeline: Activity_windows_visible id: ActivityRecord{11307b85 u0 com.clover.payment.builder.pay/com.clover.payment.common.activities.tasks.PaymentRefundCardNotPresentActivity t34} time:5008269

02-06 02:50:11.738 808-1431/? I/CloverOkHttpClient: execute(CloverOkHttpClient.java:259): Completed method: POST, to URL: https://apisandbox.dev.clover.com/v2/refund, response: 499 (Application error), elapsed time: 1315ms

02-06 02:50:11.745 1598-4005/? E/PaymentRefundCardNotPresentActivity: doInBackground(PaymentRefundCardNotPresentActivity.java:153): refund failed

com.clover.sdk.v1.ServiceException: status code: 500 This refund would make the order's total refunded amount greater than the original order's amount.

at com.clover.sdk.v1.ServiceConnector.throwOnFailure(ServiceConnector.java:329)

at com.clover.sdk.v1.ServiceConnector.execute(ServiceConnector.java:260)

at com.clover.sdk.v3.order.OrderV31Connector.refund2(OrderV31Connector.java:782)

at com.clover.payment.common.activities.tasks.PaymentRefundCardNotPresentActivity$1.doInBackground(PaymentRefundCardNotPresentActivity.java:137)

at com.clover.payment.common.activities.tasks.PaymentRefundCardNotPresentActivity$1.doInBackground(PaymentRefundCardNotPresentActivity.java:40)

at android.os.AsyncTask$2.call(AsyncTask.java:292)

at java.util.concurrent.FutureTask.run(FutureTask.java:237)

at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)

at java.lang.Thread.run(Thread.java:818)

02-06 02:50:11.746 1598-4005/? E/PaymentRefundCardNotPresentActivity: doInBackground(PaymentRefundCardNotPresentActivity.java:156): This refund would make the

order's total refunded amount greater than the original order's amount.


Note: We have tried with both partial and full refund and also verified the amount and it was less than or equal to the total amount. Also I just want to update you that the same code was working fine earlier. We are testing it in sandbox environment.


Please let us know if we have missed any, also provide the solutions for the same.


Thanks.


PaymentsPaymentConnectorRefund
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.

David Marginian avatar image David Marginian ♦♦ commented ·

In a private post can you provide your merchant id and the payment id of the payment you are trying to refund?

0 Likes 0 ·
Sukhbir Singh avatar image Sukhbir Singh David Marginian ♦♦ commented ·

Hi @David Marginian Thanks for your response. We have been facing the same issue with all payment transactions. Also, we have not found the option for the private post, so can you please suggest a way for the same.

0 Likes 0 ·

1 Answer

Sukhbir Singh avatar image
Sukhbir Singh answered

Hi @David Marginian,

Now the issue has resolved. We were generate the new order for every Sale transaction that's why issue was occurring. when we removed the setOrderId(order_id) method from the sale request then refund worked as expected.

Thank you so much for your support.

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