Needs keys Makes a card the workspace's default. With Stripe (STRIPE_SECRET_KEY), it attaches the payment method to the workspace's Stripe customer if needed, sets it as the customer's default and stores its brand, last 4 digits and expiry. Without Stripe, the mock stores the card details you send. Admin only.
Request#
| Field | Type | Required | Description |
|---|---|---|---|
payment_method_id |
string | Yes | Stripe payment method ID (at least 3 characters). In mock mode any ID. |
brand |
string | No | Mock only. Default visa. |
last4 |
string | No | Mock only. 4 digits. Default 4242. |
exp |
string | No | Mock only. Default 12/30. |
Example request#
curl -X POST https://api.tried.com.au/billing/payment-methods/default \
-H "Authorization: Bearer $TRIED_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"payment_method_id": "pm_1QxYz2AbCdEfGhIj"
}'const res = await fetch("https://api.tried.com.au/billing/payment-methods/default", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.TRIED_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"payment_method_id": "pm_1QxYz2AbCdEfGhIj"
}),
});
const methods = await res.json();import os, requests
res = requests.post(
"https://api.tried.com.au/billing/payment-methods/default",
headers={"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"},
json={
"payment_method_id": "pm_1QxYz2AbCdEfGhIj",
},
)
methods = res.json()Response#
200 OK
{
"provider": "stripe",
"payment_methods": [
{
"id": "pm_1QxYz2AbCdEfGhIj",
"brand": "mastercard",
"last4": "4444",
"exp": "08/29",
"is_default": true
}
]
}Returns the card list, as in List payment methods.
Errors#
| Status | When |
|---|---|
400 |
Validation failed, for example payment_method_id: Required or last4: Invalid. |
401 |
Missing or invalid API key. |
403 |
The key's IP allowlist or scopes reject the request. This route needs the admin scope. A dashboard user without the right role gets Requires role: admin. API keys act as admin. |
429 |
Rate limit exceeded. See Rate limits. |
500 |
Stripe rejected the request. Outside production the message is Stripe's error text. |
See Errors for the body format.