Start card autopay for a site
Try itMakes the set-up link for the site's client to put a card on file; once they do, Stripe charges it the site's monthly price every month and each month's invoice marks itself paid. Needs card payments on (your own Stripe connected), a client on the site and a monthly price of $0.50 or more. A site that already has one gets it back (200, created false).
/api/v1/sites/{site_id}/autopayAuthentication
An API key as Authorization: Bearer or x-api-key. It needs the invoices:write scope — write, send, mark paid and void client invoices; run monthly invoices; start and stop card autopay.
Parameters
Named placeholders go in the path; the rest in a JSON body.
site_idstringPath · required- The site's id.1 to 100 characters
Response
201 with JSON on success (schema on the right). Errors use the standard envelope; a retry with the same Idempotency-Key gets the first answer back (how retries work).
curl -X POST 'https://websites.workflowcorp.com/api/v1/sites/SITE_ID/autopay' \
-H "Authorization: Bearer $WEBSITEBUDDY_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{}'{
"site_id": "SITE_ID"
}{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"site_id": {
"type": "string"
},
"site_name": {
"type": "string"
},
"client_id": {
"type": "string"
},
"client_name": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"pending",
"active",
"past_due",
"canceled"
],
"description": "pending = link made, no card yet · active = charged every month · past_due = the card was declined (Stripe retries) · canceled = stopped."
},
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "What the card is charged each month (the retail price when the link was made)."
},
"currency": {
"type": "string"
},
"setup_link": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "The client's set-up page, while pending — send it to them."
},
"first_charge_at": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"started_at": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"last_paid_at": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"canceled_at": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"is_sample": {
"type": "boolean"
},
"created_at": {
"type": "string"
},
"created": {
"type": "boolean"
}
},
"required": [
"id",
"site_id",
"site_name",
"client_id",
"client_name",
"status",
"amount_cents",
"currency",
"setup_link",
"first_charge_at",
"started_at",
"last_paid_at",
"canceled_at",
"is_sample",
"created_at",
"created"
],
"additionalProperties": false
}