---
title: "Get a URL for adding a payment method"
method: POST
path: "/api/billing/setup"
tags: ["Billing"]
---

# Get a URL for adding a payment method

`POST /api/billing/setup`

## Request

- Base URL: `https://domani.run`
- URL: `https://domani.run/api/billing/setup`
- Auth: HTTP bearer

Always returns both a Stripe Checkout `url` and a SetupIntent `client_secret` for adding a credit card. An agent that cannot run Stripe.js should open `url` in a browser and tell the user to add their card there; a frontend embedding Stripe Elements directly (such as the Domani dashboard) uses `client_secret` instead. This is required before purchasing domains with a card. After the user completes checkout, they are redirected back to the dashboard.

## Request body

- object
  - `mode` 'setup_intent' | 'checkout': Deprecated: both `url` and `client_secret` are always returned regardless of this value. Kept for backward compatibility.

## Response `200`

Checkout URL and client secret for adding a card

- object
  - `url` string, uri, required: Stripe Checkout URL - open this in a browser to add a card
  - `client_secret` string, required: Stripe SetupIntent client secret, for a frontend using Stripe.js directly
  - `hint` string, required: Next steps guidance

## Other responses

- `401`: Missing or invalid API key
- `429`: Rate limit exceeded - wait and retry

---

[API](https://skmtc.dev/domani/apis/domani-run-api.md) · [All operations](https://skmtc.dev/domani/apis/domani-run-api/llms.txt) · [OpenAPI document](https://skmtc.dev/domani/apis/domani-run-api/revisions/7679f8159533?raw)
