Skip to content
crypto-businessusdcrefunds
Joshua C.

How to Issue USDC Refunds for Onchain Payments

Learn the correct process for issuing USDC refunds for onchain payments in crypto business operations. Step-by-step guide with example and code for refunding USDC.

How to Issue USDC Refunds for Onchain Payments

Processing refunds is a standard part of business operations. Onchain settlements with USDC are different from card payments. There is no built-in reversal. Once a transaction is confirmed on the blockchain, the funds are final. If you need to issue a refund, you must send a new transaction returning funds to the customer. This guide explains how to do that, what to log, and how to communicate the process to your team and users.

When Is a Refund Necessary?

Refunds are relevant when you have already received and settled a USDC payment. Common reasons:

  • The customer paid for a product or service you cannot deliver.
  • There was an overpayment or duplicate payment.
  • The customer canceled before fulfillment.

You cannot reverse the onchain payment itself. Instead, you send a new USDC transfer to the customer’s wallet address.

What You Need to Issue a Refund

  • The USDC contract address for the chain where the payment settled (Base, Ethereum, or Polygon).
  • The wallet address that paid you.
  • The amount to refund.
  • Access to the merchant wallet holding the USDC you received.
  • A way to track the refund for your internal records and for the customer.

Step 1: Identify the Original Payment

Locate the transaction hash for the original USDC payment. Retrieve:

  • Customer’s sending wallet address.
  • Amount received (minus gas, if relevant).
  • Chain where it settled.
  • Date and time.

This information is usually in your payment logging or settlement subsystem. If not, you may need to look up the transaction on a block explorer (like Etherscan, Basescan, or Polygonscan) using the merchant wallet address.

Step 2: Validate the Refund Request

Before sending any funds, verify:

  • The request is legitimate. Authenticate the customer.
  • The refund amount matches the business policy (partial or full).
  • The merchant wallet has enough USDC to cover the refund, plus gas for the transaction.

Step 3: Prepare and Send the Refund

You refund by sending USDC from your merchant wallet to the customer’s address. Here’s how to do it using ethers.js, which works with all supported chains.

Example: Refunding 100 USDC on Polygon

Assume: - Customer address: 0xCustomerAddr123... - Merchant wallet private key available in the environment (never expose in code) - Amount: 100 USDC - USDC contract address on Polygon: 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 - RPC URL for Polygon: https://polygon-rpc.com

1. Install ethers.js if you do not have it:

npm install ethers

2. Code to Send USDC Refund:

const { ethers } = require("ethers");

// USDC contract ABI fragment for transfer
const ERC20_ABI = ["function transfer(address to, uint256 amount) returns (bool)"];

const USDC_ADDRESS = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"; // Polygon USDC
const RPC_URL = "https://polygon-rpc.com";

const provider = new ethers.JsonRpcProvider(RPC_URL);
const merchantPrivateKey = process.env.MERCHANT_PRIVATE_KEY;
const wallet = new ethers.Wallet(merchantPrivateKey, provider);

const customerAddress = "0xCustomerAddr123...";
const amount = ethers.parseUnits("100", 6); // USDC uses 6 decimals

async function refundUSDC() {
  const usdc = new ethers.Contract(USDC_ADDRESS, ERC20_ABI, wallet);
  const tx = await usdc.transfer(customerAddress, amount);
  console.log("Refund TX hash:", tx.hash);
  await tx.wait();
  console.log("Refund confirmed onchain.");
}

refundUSDC();
  • Replace MERCHANT_PRIVATE_KEY with your merchant wallet’s private key in a secure environment variable.
  • Confirm USDC decimals are correct (USDC uses 6).
  • Log the transaction hash for your records and to provide to the customer.

Step 4: Communicate the Refund

  • Notify the customer of the refund transaction hash.
  • Let them know which chain the funds are on.
  • Explain that onchain settlement is final. The refund is a new payment, not a reversal of the original.
  • Provide an estimated time to confirmation (usually seconds to minutes).

Step 5: Reconcile in Your Systems

  • Mark the original payment as refunded (full or partial).
  • Store the refund transaction hash linked to the original payment.
  • Update inventory, licensing, or service access as needed.
  • If reporting for tax or accounting, log both the initial payment and the refund separately.

Edge Cases and Considerations

Gas Fees and Partial Refunds

  • Gas is paid by the merchant wallet for the refund transaction.
  • If you are refunding less than the full amount, state the policy in your customer documentation.

Wrong Address or Lost Wallet

  • If a customer claims loss of wallet access, only refund to the original address unless robust offchain KYC is in place.
  • Do not send refunds to a different address without clear, verifiable proof.

Refund Window

  • Set a clear refund window in your business terms. Onchain settlement means you cannot delay refunds indefinitely without operational risk.

Multi-Chain Handling

  • Refund on the same chain as the original payment. Do not move funds across chains unless your business explicitly supports and documents bridging flows.

Example: Full Refund Scenario

A SaaS product charges a customer 200 USDC on Base. The customer cancels within the refund window. Steps:

  1. Locate the transaction: The merchant finds the 200 USDC payment from 0xCustomerA... to their settlement address on Base. The transaction hash is 0xabc....
  2. Validate: The customer’s request matches internal records. The merchant settlement address holds enough USDC.
  3. Refund: Merchant sends 200 USDC back to 0xCustomerA... using the Base USDC contract. The refund transaction hash is generated and logged.
  4. Notify: Customer receives the refund hash and a link to view it on Basescan.
  5. Reconcile: Mark the original invoice as refunded, close out the customer’s account, and update books.

How We Handle Refunds at Reclack

We do not reverse payments onchain. When a refund is required, we provide the merchant with the payer’s address, the payment details, and a workflow to initiate a new USDC transfer from the merchant’s own settlement wallet. We log every original payment and its refund for traceability. Our customer portal shows payment and refund status, so both sides have receipts. Merchants always control their funds. If you want to see how onchain business payments and refunds work in practice, visit reclack.com.

crypto-businessusdcrefunds