Card cancel method in Mobile Payment SDK

How to cancel paid order using Mobile Payment SDK?

I know referenceId and cardDetails.getAuthorizationCode()

I was not able to find the way to cancel order in the guide
(Mobile Payments SDK)

:waving_hand: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Deauthorize the Reader SDK
Mobile Authorization API: How It Works
Capture a Transaction

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

To cancel a paid order, you would need to issue a refund rather than cancel the order. Once a payment has been made, the order itself cannot be cancelled, but the payment can be refunded.

To refund a payment, you would use the Refunds API. You would need the payment.id value and the amount to refund. The Refunds API can refund a payment processed by Square, regardless of whether the payment was taken with a Square product or with your application.

Please note that the Refunds API cannot refund payments whose original payment date is more than 1 year ago, you cannot refund more than what was originally collected, and you can only refund payments with the status of COMPLETED.

For a card payment, you cannot refund an APPROVED payment; however, you can cancel an APPROVED card payment.

Please note that the Mobile Payment SDK does not directly support refund operations. You would need to make these calls from your server-side code.

This answer was reviewed by @Bryan-Square.