技能 编程开发 Ramp API:卡片与费用管理

Ramp API:卡片与费用管理

v20260423
ramp-hello-world
使用本技能连接Ramp API,实现企业卡和费用数据的管理与追踪。它允许用户列出虚拟卡片信息、获取详细的近期交易记录,并查询用户档案。适用于构建财务同步工具、高级费用报销系统或企业卡管理流程的开发场景。
获取技能
482 次下载
概览

Ramp Hello World

Overview

List cards, get transactions, and check user details using the Ramp API.

Prerequisites

  • Completed ramp-install-auth with valid access token

Instructions

Step 1: List Virtual Cards

resp = requests.get(f"{BASE}/cards", headers=headers, params={"page_size": 10})
for card in resp.json()["data"]:
    print(f"Card: {card['display_name']} — Limit: ${card['spending_restrictions']['amount']/100:.2f}")
    print(f"  Status: {card['state']}, Last4: {card['last_four']}")

Step 2: Get Recent Transactions

resp = requests.get(f"{BASE}/transactions", headers=headers, params={
    "start_date": "2026-01-01",
    "page_size": 10,
})
for tx in resp.json()["data"]:
    print(f"${tx['amount']/100:.2f} at {tx['merchant_name']} — {tx['sk_category_name']}")

Step 3: List Users

resp = requests.get(f"{BASE}/users", headers=headers, params={"page_size": 10})
for user in resp.json()["data"]:
    print(f"  {user['first_name']} {user['last_name']} — {user['role']}")

Output

  • Cards listed with limits and status
  • Recent transactions with merchant details
  • Users with role information

Error Handling

ErrorCauseSolution
Empty resultsNo data in sandboxCreate test cards first
403 ForbiddenInsufficient permissionsCheck API app permissions
400 Bad date formatWrong date formatUse ISO 8601: YYYY-MM-DD

Resources

Next Steps

Issue virtual cards: ramp-core-workflow-a

信息
分类 编程开发
名称 ramp-hello-world
版本 v20260423
大小 2.16KB
更新时间 2026-04-28
语言