Create refunds from trusted server code using the payment ID. For a partial refund, send an amount in minor units; otherwise refund the remaining amount. Record the refund ID in your order system and process refund events idempotently. A refund request being accepted is not the same as a completed refund, so update customer-facing state from the final refund event. Before refunding, verify the merchant payment, amount, currency, and order ownership. Do not accept a payment ID or amount from an untrusted browser without resolving it against your own order.