Issue and manage virtual cards with spending limits, policies, and lifecycle management.
ramp-hello-world
card = requests.post(f"{BASE}/cards", headers={**headers, "Content-Type": "application/json"}, json={
"holder_name": "Jane Smith",
"spending_restrictions": {
"amount": 50000, # $500.00 in cents
"interval": "monthly", # monthly, yearly, total
},
"display_name": "Marketing Software",
"fulfillment": { "card_type": "virtual" },
})
card.raise_for_status()
card_id = card.json()["id"]
print(f"Virtual card issued: {card_id}")
requests.patch(f"{BASE}/cards/{card_id}", headers={**headers, "Content-Type": "application/json"}, json={
"spending_restrictions": {
"amount": 100000, # Increase to $1,000
"interval": "monthly",
},
})
requests.post(f"{BASE}/cards/{card_id}/suspend", headers=headers)
print(f"Card {card_id} suspended")
requests.post(f"{BASE}/cards/{card_id}/terminate", headers=headers)
print(f"Card {card_id} terminated")
| Error | Cause | Solution |
|---|---|---|
422 Invalid holder |
User not found | Verify holder is a Ramp user |
400 Invalid amount |
Amount not in cents | Multiply dollars by 100 |
| Card already terminated | Cannot modify | Check card state first |
Transaction management: ramp-core-workflow-b