> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sprintcheckout.com/llms.txt
> Use this file to discover all available pages before exploring further.

# One-click payments

> Learn how One-click crypto payments® work.

<iframe width="560" height="315" src="https://www.youtube.com/embed/A2hdsRllTNQ?si=XQG1ipy24X-2Jxjl" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="true" />

One-click crypto payments® revolutionize the way users pay with crypto by eliminating the traditional two-step approval process. This innovative solution combines token approval and transfer into a single, gasless transaction, providing a seamless experience similar to traditional payment methods while maintaining the security and transparency of blockchain technology.

## Traditional payment flow

<Note>
  When making an ERC20 payment through a dapp, you are required to:

  1. sign an allowance for the dapp to spend on your behalf
  2. execute the transfer.

  **Both transactions have gas costs that the user needs to pay in ETH.**
</Note>

```mermaid theme={null}

sequenceDiagram
    participant User
    participant Wallet
    participant DApp
    participant ERC20

    Note over User, ERC20: Approval Phase
    User->>DApp: Click "Allow"
    DApp->>Wallet: Request Allowance
    Wallet->>User: Approve?
    User->>Wallet: Approve
    Wallet->>ERC20: Returns signed Allowance
    Note right of Wallet: USER PAYS GAS IN ETH
    ERC20->>ERC20: Check & update allowance
    ERC20-->>User: Approval confirmed

    Note over User, ERC20: Transfer Phase
    User->>DApp: Click "Pay"
    DApp->>Wallet: Request transferFrom
    Wallet->>User: Sign transaction?
    User->>Wallet: Sign transaction
    Wallet->>ERC20: transferFrom (user, recipient, amount)
    Note right of Wallet: USER PAYS GAS IN ETH
    ERC20->>ERC20: Transfer tokens
    ERC20-->>DApp: Transfer successful
    DApp-->>User: Transaction successful (Blockexplorer url)
```

## One-click crypto payment® flow

<Tip>
  When using one-click crypto Payment® through our dapp, you only need to:

  1. Sign a permit function that bundles the allowance and transfer of funds.

  **This permit function has no gas cost, so you don't need to pay any ETH.**

  2. Our dapp requests to transfer the funds on your behalf, and we pay the gas in ETH.
</Tip>

```mermaid theme={null}

sequenceDiagram
    participant User
    participant Wallet
    participant DApp
    participant ERC20 as ERC20 (with Permit)

    User->>DApp: Click "Pay"
    DApp->>Wallet: Request permit signature
    Wallet->>User: Permit signature?
    User->>Wallet: Permit signature
    Wallet->>DApp: Returns signed permit
    
    DApp->>ERC20: UserOp (Allowance + Transfer)
    Note right of DApp: DAPP PAYS GAS
    ERC20->>ERC20: Validates signature & transfers tokens
    ERC20-->>DApp: Success
    DApp-->>User: Payment complete
```

## Technical Implementation

One-click crypto payments® leverage the EIP-2612 permit standard to create a more efficient token approval mechanism. Here's how it works:

1. **Permit Signature**: Instead of calling `approve()`, the dapp requests a permit signature from the user's wallet. This signature contains:
   * The token approval amount (set to match the purchase amount)
   * The deadline for the approval (set to 5 minutes only)
   * The spender address (dapp)
   * A nonce to prevent replay attacks

2. **Bundled Transaction**: The dapp then submits a single transaction that:
   * Validates the permit signature
   * Executes the token transfer
   * Pays for all gas costs

3. **Security Features**:
   * Time-bound approvals through deadlines (5 minutes only)
   * Nonce-based signature verification
   * Replay attack protection
   * Atomic transactions (either both operations succeed or both fail)

## Benefits

One-click crypto payments® offer significant advantages for both users and merchants:

### For Users

* **Simplified Experience**: Single signature instead of two separate transactions
* **No ETH Required**: Users don't need to hold ETH for gas fees
* **Faster Checkout**: Transaction time reduced by half
* **Lower Costs**: No gas fees to pay for approvals
* **Better Security**: Time-bound approvals with automatic expiration

### For Merchants

* **Higher Conversion Rates**: Reduced friction leads to up to 30% more completed transactions
* **Better User Experience**: Customers are more likely to return
* **Gas Cost Control**: Predictable gas costs for the business
* **Competitive Advantage**: Stand out with modern payment solutions
* **Increased Trust**: Transparent and secure payment process

## Transaction costs

### Traditional allowance and transferFrom payment

| Step         |                  |
| ------------ | :--------------: |
| Gas paid in  |        ETH       |
| Gas Cost     | On L2s few cents |
| Who pays Gas |       User       |

### With one-click crypto payments®

| Step         |                       |
| ------------ | :-------------------: |
| Gas paid in  |         ERC20         |
| Gas Cost     | On L2s under one cent |
| Who pays Gas |      Merchant(ℹ︎)     |

(ℹ︎) Merchants can limit the amount they want to sponsor. For example, 0.2% of the purchase value.

<Frame>
  <img src="https://mintcdn.com/sprintcheckout/Uctu2g9oQF9GwBEr/images/token-configuration.png?fit=max&auto=format&n=Uctu2g9oQF9GwBEr&q=85&s=28b746df6e85278755d4371e5944d049" alt="Token configuration interface showing Base network with USDC, DAI, and BIRB tokens. USDC has 0.5% gas sponsorship, DAI has 0.2%, and BIRB is not available." width="1158" height="436" data-path="images/token-configuration.png" />
</Frame>

## Supported tokens and chains

| Chain    | Tokens |     Status     |
| -------- | :----: | :------------: |
| Base     |  USDC  |        ✅       |
| Ethereum |  USDC  | *comming soon* |
| Optimism |  USDC  | *comming soon* |
| Arbitrum |  USDC  | *comming soon* |
| Base     |  USDT  | *comming soon* |
| Ethereum |  USDT  | *comming soon* |
| Optimism |  USDT  | *comming soon* |
| Arbitrum |  USDT  | *comming soon* |

## Frequently Asked Questions

### What happens if a permit signature expires?

Permit signatures have a built-in deadline. If a signature expires before the transaction is processed, the user will need to sign a new permit. This is a security feature to prevent delayed or malicious transactions.

### Do I need to hold any ETH in my wallet?

No, you don't need to hold any ETH. All gas costs are covered by the merchant through the one-click payment system.

### Which wallets support one-click payments?

One-click payments are supported by all major Web3 wallets that implement the EIP-2612 standard, including MetaMask, Coinbase Wallet, Binance Web3 wallet, WalletConnect, and most other popular wallets.

### What happens if the transaction fails?

If a transaction fails, no tokens will be transferred from your wallet. The permit signature is only valid for a specific amount and time period, ensuring your funds remain secure.

### Can I set a custom approval amount?

The permit signature is built with the specific amount needed for the purchase.

### Is this solution secure?

Yes, one-click payments use industry-standard cryptographic signatures and follow the EIP-2612 specification. The system includes multiple security features like nonce verification and time-bound approvals.
