跳转到主要内容

什么是储蓄账户?

KillB 中的储蓄账户是以美元计价的托管账户,允许用户从存款中赚取收益。KillB 管理托管,而用户保持完全所有权。
储蓄账户通过合作银行获得 FDIC 保险,提供安全的美元价值持有方式。

主要功能

美元计价

以美元持有价值,免受本地货币波动影响

多种存款方式

通过 ACH、电汇或加密货币存款

轻松提款

随时提款到银行账户或加密货币钱包

交易历史

跟踪所有存款和提款

创建储蓄账户

POST /api/v2/savings
{
  "userId": "user-id",
  "acceptedTermsAndConditions": true
}
const createSavingsAccount = async (userId) => {
  const response = await fetch(
    'https://teste-94u93qnn.uc.gateway.dev/api/v2/savings',
    {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        userId: userId,
        acceptedTermsAndConditions: true
      })
    }
  );
  
  return await response.json();
};
响应:
{
  "id": "savings-account-id",
  "userId": "user-id",
  "status": "PENDING",
  "createdAt": "2024-01-15T10:30:00.000Z"
}

检查余额

GET /api/v2/savings/{savingsAccountId}/balance
const getBalance = async (savingsAccountId) => {
  const response = await fetch(
    `https://teste-94u93qnn.uc.gateway.dev/api/v2/savings/${savingsAccountId}/balance`,
    {
      headers: {
        'Authorization': `Bearer ${token}`
      }
    }
  );
  
  const balance = await response.json();
  console.log(`余额: $${balance.amount} ${balance.currency}`);
  return balance;
};

存款方式

ACH 存款

获取 ACH 存款说明:
GET /api/v2/savings/{savingsAccountId}/deposit-instructions/ACH
响应
{
  "type": "ACH",
  "currency": "USD",
  "accountHolderName": "Bridge Bank",
  "accountNumber": "123456789",
  "routingNumber": "987654321",
  "memo": "ABC123"
}
重要: 用户必须在转账中包含 memo 以便正确入账。

电汇存款

GET /api/v2/savings/{savingsAccountId}/deposit-instructions/WIRE

加密货币存款

获取加密货币存款的钱包地址:
GET /api/v2/savings/{savingsAccountId}/crypto-deposit-instructions
响应
{
  "address": "0x123...",
  "network": "POLYGON",
  "currency": "USDC"
}
用户将 USDC 发送到此地址,自动转换为 USD。

提款

创建到外部账户的提款:
POST /api/v2/savings/withdrawal
{
  "source": {
    "savingsAccountId": "savings-id"
  },
  "destination": {
    "savingsAccountId": "savings-id",
    "externalAccountId": "bank-or-wallet-id"
  },
  "amount": 1000,
  "comment": "提款到银行账户"
}

交易历史

获取所有储蓄交易:
GET /api/v2/savings/transactions?userId=user-id
响应
{
  "transactions": [
    {
      "id": "txn-1",
      "type": "DEPOSIT",
      "amount": "1000.00",
      "currency": "USD",
      "createdAt": "2024-01-15T10:30:00.000Z"
    }
  ],
  "totalPage": 1
}

下一步