question

mtt avatar image
mtt asked mtt commented

JS SDK: full refund via refundPayment() possible?

I've been getting this in the console:

var refundRequest = new clover.remotepay.RefundPaymentRequest();
        refundRequest.setPaymentId(transactionId);
        refundRequest.setFullRefund(true);
        this.cloverConnector.refundPayment(refundRequest);

Result:

klass {success: false, result: "FAIL", reason: "FAIL", message: undefined, refund: undefined}

I was wondering if it was related to: https://devask.clover.com/question/11...

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

hammer avatar image
hammer answered mtt commented

The order id for the payment is required as well.

var refundRequest = new clover.remotepay.RefundPaymentRequest();
        refundRequest.setOrderId(orderId);
        refundRequest.setPaymentId(transactionId);
        refundRequest.setFullRefund(true);
        this.cloverConnector.refundPayment(refundRequest);

The error message is unexpected though. We will look at why it is not coming back with the descriptive error.

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

hammer avatar image hammer ♦ commented ·

Note: The error message is not correct, and an issue has been registered.

0 Likes 0 ·
mtt avatar image mtt commented ·

Thanks hammer. The refund worked.

0 Likes 0 ·

Welcome to the
Clover Developer Community