Reconcile unused NEAR tokens after ft_transfer_call

A token transfer with a receiver callback can settle for less than the requested amount. A ledger that records the initial debit as the completed sale will overstate revenue after a partial refund.

Track the receiver’s response

These illustrative method arguments request 1000 base units. The token contract credits the receiver and invokes ft_on_transfer. Its return amount denotes how many units were unused. Record the original action and the receiver receipt separately.

{
  "receiver_id": "checkout.testnet",
  "amount": "1000",
  "msg": "order-42"
}

Read the resolver before settling the order

If the receiver reports 250 unused and has enough tokens left to refund them, 750 of the original 1000 were used. The resolver handles the actual refund. A lower remaining balance can limit how much can be returned, so use execution results rather than subtracting the requested refund unconditionally.

Link the resolver result to the same transaction and token contract. Reuse the order identifier only as business metadata; another account can construct the same msg value.

Sources