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

# How Auto-Payments Work

> Understanding the architecture behind decentralized recurring payments on Ethereum

<span style={{display:"none"}}>For the complete documentation index, see [llms.txt](/llms.txt).</span>

## The Pull-vs-Push Problem

Traditional payment systems like Stripe work through **permission-based pulls**. When you give Stripe your card details, you're authorizing them to pull funds from your account.

<CardGroup cols={2}>
  <Card title="What Users See" icon="hand-pointer">
    Appears as if you're pushing payment
  </Card>

  <Card title="What Actually Happens" icon="arrows-rotate">
    Stripe pulls funds from your account
  </Card>
</CardGroup>

### Traditional System Issues

<Steps>
  <Step title="Trust dependency">
    You must trust Stripe with your card details and security
  </Step>

  <Step title="Centralization">
    Single point of failure - if Stripe goes down, payments stop
  </Step>

  <Step title="Censorship">
    Companies can deny service (e.g., sanctioned countries can't use Stripe)
  </Step>

  <Step title="Lack of control">
    They can lock you out of the system at any time
  </Step>
</Steps>

***

## The Ethereum Challenge

Ethereum has two account types, neither perfect for auto-payments:

<Tabs>
  <Tab title="EOAs (Regular Wallets)">
    **Externally Owned Accounts** ❌ Not programmable ❌ Require manual
    signature for every transaction ❌ Can't automate recurring payments ✅ Can
    initiate transactions
  </Tab>

  <Tab title="Contract Accounts">
    **Smart Contracts** ✅ Fully programmable ✅ Can store logic for automation
    ❌ Cannot initiate transactions on their own ❌ Must be triggered by EOAs
  </Tab>
</Tabs>

**The dilemma:** We need programmability AND transaction initiation, but Ethereum accounts only offer one or the other.

***

## The Solution: Account Abstraction

[Account Abstraction (ERC-4337)](https://eips.ethereum.org/EIPS/eip-4337) transforms every Ethereum account into a programmable smart contract.

**Key innovation:** Contracts can now verify **who** (address) is making a transaction without requiring **how** (signature) every time.

### What This Enables

<CardGroup cols={2}>
  <Card title="Permissionless" icon="unlock">
    Anyone with internet can use it
  </Card>

  <Card title="Censorship-Resistant" icon="shield">
    No central authority to block you
  </Card>

  <Card title="Self-Custody" icon="key">
    Users keep their private keys
  </Card>

  <Card title="Decentralized" icon="network-wired">
    Multiple entities can trigger payments
  </Card>
</CardGroup>

***

## How Shakesco Works

### Basic Flow

<Steps>
  <Step title="Merchant requests payment">
    You identify the customer and set amount + period
  </Step>

  <Step title="Customer approves once">
    User accepts the subscription request in Shakesco app
  </Step>

  <Step title="Automated execution">
    System pulls payments on schedule without further approval
  </Step>

  <Step title="Service delivery">
    Check payment status and grant access accordingly
  </Step>
</Steps>

***

## Key Features

### One-Time Payments

For single pull requests:

```javascript theme={null}
period: 0;
start_period: 0;
```

User approves once, payment executes once. Status returns `has_paid: true` until you request again.

### Supported Tokens

**USDT (Global stablecoin)**

<Tabs>
  <Tab title="Polygon">
    | Token | Address                                      |
    | ----- | -------------------------------------------- |
    | USDT  | `0xc2132D05D31c914a87C6611C10748AEb04B58e8F` |
  </Tab>

  <Tab title="Ethereum">
    | Token | Address                                      |
    | ----- | -------------------------------------------- |
    | USDT  | `0xdAC17F958D2ee523a2206206994597C13D831ec7` |
  </Tab>
</Tabs>

<Warning>
  Token addresses must be checksummed. Use the addresses above exactly as shown.
</Warning>

### Updating Subscription Terms

<Accordion title="Changing amount">
  Update freely. Users continue service until current period ends, then new
  amount applies.
</Accordion>

<Accordion title="Changing period">
  Update freely. Users continue service until current period ends, then new
  period applies.
</Accordion>

***

## Important Parameters

### Period

Must be in seconds:

| Interval          | Seconds    |
| ----------------- | ---------- |
| 1 week            | `604800`   |
| 1 month (30 days) | `2592000`  |
| 1 year            | `31536000` |

<Warning>
  Minimum period: **2 days (172800 seconds)**. System executes pulls every 2
  days. Need daily intervals? [Contact us](https://shakesco.com/contact).
</Warning>

### Amount

Enter in base units (not wei):

```javascript theme={null}
amount: 20; // For $20 USD
```

Use `parseUnits` as shown in SDK docs.

<Warning>
  SDK expects USD amounts. Convert from local currency first. API supports
  [multiple currencies](/api-reference/auto-payments/codes).
</Warning>

### Fees

Check current rates at [shakesco.com/charges](https://shakesco.com/charges) under "Card Charges".

***

## Additional Features

### Discount Period

Free trial configured during account deployment. Users get one free trial per account.

### Grace Period

Time after payment due date before service is suspended. Can be edited after deployment.

***

## Request & Payment Flow

<Steps>
  <Step title="Request subscription">
    Use `requestUser` / `requestBusiness` (SDK) or `/request` (API)
  </Step>

  <Step title="User approves">Customer accepts request in Shakesco app</Step>

  <Step title="Check payment status">
    Use `hasPaid` (SDK) or `/has_paid` (API) before granting service
  </Step>
</Steps>

<Warning>
  **Critical:** Always check `hasPaid` before delivering service. This is your
  only verification method.
</Warning>

***

## Get Started

<CardGroup cols={2}>
  <Card title="SDK Integration" icon="code" href="/auto-payments/integrate">
    Integrate with JavaScript/TypeScript
  </Card>

  <Card title="API Integration" icon="webhook" href="/api-reference/auto-payments/request">
    Integrate with REST API
  </Card>
</CardGroup>
