Once a Shopify order is marked as Paid, you cannot programatically change its status if the funds are returned to your customer.
To properly reconcile this status:
-
Sign in to the Dashboard.
-
Go to Payments > Processing > _All _Payments.
-
Ensure that the payment status is Returned in the Dashboard.
-
Manually cancel the paid order in your Shopify dashboard.