Back to Docs

Refunds

Information about processing refunds and handling payment disputes.

1

Refund Overview


Yeld supports refunding payments that have been received. Refunds can be issued for various reasons such as customer disputes, service issues, or errors.

**Important Notes:**
- Refunds are processed back to the original sender's address
- Blockchain transactions cannot be reversed once confirmed
- Refund availability depends on the token and network used
2

Refund Process


**Manual Refund Process:**

```typescript
// Refund a payment (conceptual - implementation varies)
async function processRefund(
  sessionId: string,
  amount: string,
  reason: string
) {
  // 1. Verify the original transaction
  const session = await db
    .select()
    .from(checkoutSessions)
    .where(eq(checkoutSessions.id, sessionId))
    .limit(1);

  if (!session || session.status !== "confirmed") {
    throw new Error("Payment not found or not confirmed");
  }

  // 2. Send refund to original sender
  await sendPayment({
    to: session.senderAddress,
    amount: amount,
    token: "USDC",
    network: session.chain,
    memo: `Refund: ${reason}`,
  });

  // 3. Update session status
  await db
    .update(checkoutSessions)
    .set({ status: "refunded" })
    .where(eq(checkoutSessions.id, sessionId));
}
```

**Refund States:**
- `pending`: Refund initiated, awaiting processing
- `completed`: Refund sent successfully
- `failed`: Refund could not be processed
3

Refund Policy Considerations


**Before Issuing Refunds:**

1. **Verify Original Transaction**
   - Confirm the payment was received
   - Check the transaction hash
   - Verify the amount matches

2. **Check Refund Eligibility**
   - Ensure the payment was for a refundable service
   - Verify the refund window (if applicable)
   - Confirm customer identity

3. **Document the Reason**
   - Record why the refund is being issued
   - Keep records for accounting purposes
   - Update your internal systems

4. **Process the Refund**
   - Send the refund to the original sender
   - Update your records
   - Notify the customer
4

Common Refund Scenarios


**Scenario 1: Service Not Delivered**
```
Customer paid for a service that wasn't delivered.

Resolution:
1. Verify the payment was received
2. Issue refund to original sender
3. Update your records
4. Communicate with customer
```

**Scenario 2: Double Payment**
```
Customer accidentally paid twice.

Resolution:
1. Identify the duplicate payment
2. Refund the duplicate amount
3. Keep the original payment
4. Notify customer of the correction
```

**Scenario 3: Pricing Error**
```
There was an error in the displayed price.

Resolution:
1. Assess the situation
2. Issue partial or full refund based on agreement
3. Update the checkout link with correct pricing
4. Document the incident
```

Important Warning

Blockchain transactions are irreversible once confirmed. Always verify the recipient address before sending any refund. Sending to an incorrect address may result in permanent loss of funds.

Refund FAQ

Can I refund a payment?

Yes, you can refund payments to the original sender's address. Refunds are processed as separate transactions on the blockchain.

How long do refunds take?

Refunds are processed as blockchain transactions and typically confirm within a few minutes to an hour, depending on network conditions.

Are there fees for refunds?

Standard blockchain gas fees apply for refund transactions. These fees are paid by the sender (you) and vary based on network conditions.