Take an email plan, or change it
PUT/v1/billing/email_subscription
Without a plan, or with one cancelled or past due, the chosen plan is paid for a month from the balance now and that month starts now. A bigger plan than the current one applies at once and charges the difference; a smaller one starts at the next renewal. The same plan again charges nothing, and takes back a cancellation. overage keeps its current value when it is left out.
Body
| Field | Type | Description |
|---|---|---|
| up_torequired | integer | The plan's size |
| overage | boolean | Past the plan's emails |
Example
curl -X PUT https://api.woyra.io/v1/billing/email_subscription \
-H "Authorization: Bearer $WOYRA_KEY" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: set-email-subscription-1' \
-d '{
"up_to": 1
}'Response
200 The plan as it now stands.
| Field | Type | Description |
|---|---|---|
| objectrequired | "email_subscription" | |
| statusrequired | string | past_due: the renewal could not be paid. The account sends on the
free emails until the balance can pay it, and it renews within the
hour of a top-up.One of active, past_due, cancelled. |
| planrequired | EmailPlan | |
| currencyrequired | string | |
| next_plan | EmailPlan | A smaller plan chosen for the next billing month. |
| overagerequired | boolean | |
| cancel_at_period_endrequired | boolean | Cancelled; the plan runs to current_period_end and does not renew. |
| current_period_startrequired | timestamp | |
| current_period_endrequired | timestamp | When the plan renews and its emails reset. |
| started_atrequired | timestamp | |
| cancelled_at | timestamp |
Errors
| Status | Codes |
|---|---|
| 400 | invalid_request, unsupported_version |
| 401 | authentication_required, invalid_api_key |
| 402 | insufficient_funds, spend_cap_exceeded, email_limit_reached |
Also in Billing
- POST /v1/topups — Add funds by card
- GET /v1/topups/{id} — One top-up
- POST /v1/subscriptions — Start a product subscription
- GET /v1/subscriptions/{product} — Current product subscription
- POST /v1/payments/stripe/webhook — Stripe's webhook
- GET /v1/ledger — The account statement
- GET /v1/billing/payment_options — How this account can pay
- PUT /v1/billing/payment_currency — Choose to pay in birr or in US dollars
- GET /v1/billing/bank_deposits — Recent birr bank deposits
- POST /v1/billing/bank_deposits — Request a birr bank deposit
- POST /v1/billing/bank_deposits/{id}/receipt — Upload the bank receipt for a deposit
- POST /v1/billing/bank_deposits/{id}/cancel — Cancel a deposit that has not been submitted or was returned
- GET /v1/balance — Retrieve account balance
- GET /v1/billing/email_tariff — The email price this account pays
- GET /v1/billing/email_subscription — This account's monthly email plan
- POST /v1/billing/email_subscription/cancel — Stop the email plan renewing
- GET /v1/pricing/email — The published email tariff