Turn pay as you go on or off
The switch on Plans & Billing, and the card it needs the first time.
Runs any of 2 calls on your workspace.
PATCH /billing/pay-as-you-go
The switch on Plans & Billing, and the card it needs the first time.
Example
Needs billing:write. Off takes effect at once, and usage stops at the allowances. On takes effect at once when a card is saved. The first time, checkoutUrl is a link where the person adds a card, and pay as you go starts once they have. theme and locale style the page the link opens.
curl -X PATCH "$OE/billing/pay-as-you-go" -H "$AUTH" -H 'content-type: application/json' \ -d '{ "enabled": true, "locale": "de" }'{ "object": "pay_as_you_go_switch", "enabled": false, "suspended": false, "activating": false, "checkoutUrl": "https://checkout.example.com/c/7Yw2kq9RzX4mB1vN?locale=de"}Nothing is paid through the API. The link opens the billing provider’s page, where the person pays, changes the card or cancels, as they do from the app.
An OAuth access token needs a verification code for this call. Until the app has verified one in the last 60 minutes, the call answers 403 step_up_required and changes nothing. An API key is never asked. The Authentication page shows how to ask for a code and verify it.
After the checkout
Needs billing:write. Once the person has added the card, POST /billing/pay-as-you-go/confirm checks with the billing provider and records it, as the app does when they come back. enabled says whether pay as you go is on now, and calling it again is safe.
curl -X POST "$OE/billing/pay-as-you-go/confirm" -H "$AUTH"{ "object": "pay_as_you_go_confirmation", "enabled": true }activating: true from the switch means a card was just saved and pay as you go is being turned on, so read it again in a moment.
An OAuth access token needs a verification code for this call. Until the app has verified one in the last 60 minutes, the call answers 403 step_up_required and changes nothing. An API key is never asked. The Authentication page shows how to ask for a code and verify it.