Skip to content

Enable or disable account credit for a service

PATCH/billing/managed-services/{service}/account-credit

Overview

Controls whether this service's renewal invoices can use account credit. Send pays_from_credit as true or false. It is on until turned off here, unless the account's own setting covers every service.

Credit is shared across the account and used for renewals in due-date order. Disabling it for this service leaves the balance available for other services. This service will still receive invoices on its usual schedule, which the customer must pay separately.

The setting applies to future invoices. It does not move money or change invoices already paid with credit. This option is available only when account_credit_switchable is true in the service list. Otherwise, the request is rejected with an explanation. Returns the updated service.

Permissions

Requires the billing.manage (Manage service billing) permission for the selected team. Resources outside that team return 404.

curl --request PATCH \
  --url 'https://console.advinservers.com/api/v1/client/billing/managed-services/{service}/account-credit' \
  --header 'Authorization: Bearer <token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "pays_from_credit": false
}'
{
  "service_id": 7312,
  "name": "Standard 4 GB",
  "hostname": "lambda-core.blackmesa.example.com",
  "status": "Active",
  "billing_cycle": "Monthly",
  "recurring_amount": "12.00",
  "currency": "USD",
  "server_id": "ecc6f4f1",
  "next_due_date": "2026-10-02",
  "period": {
    "starts_at": "2026-09-02",
    "ends_at": "2026-10-02",
    "total_days": 30,
    "days_remaining": 18,
    "days_overdue": 0,
    "remaining_fraction": 0.6,
    "state": "healthy"
  },
  "autopay": true,
  "autopay_ending": false,
  "subscription": {
    "uuid": "a216c52c-ccea-430f-b3bf-09aaf1025a44",
    "uuid_short": "Uuid short",
    "status": "active",
    "next_charge_at": "2026-10-02T19:15:08+00:00",
    "ends_at": null,
    "amount": "12.00",
    "currency": "USD",
    "paypal_account": "Paypal account",
    "payment_card": "Payment card"
  },
  "cancellation": null,
  "can_start_subscription": false,
  "can_cancel_subscription": true,
  "can_change_cycle": true,
  "can_cancel_service": true,
  "can_withdraw_cancellation": false,
  "immediate_refund": "7.20",
  "pays_from_credit": true,
  "can_change_credit": true,
  "autopay_provider": "card",
  "autopay_details": "active",
  "suspension_reason": null,
  "autopay_by_account": true,
  "credit_by_account": true,
  "postpaid_monthly_price": null
}

Authorization

Authorizationstringheaderrequired

Your API key, sent as a bearer token. Create one in the control panel under API Keys, give it only the permissions the integration needs, and copy it when it is created. It cannot be shown again. Each key is restricted to one owned team. The key determines the team for every request.

Send it as Bearer <token>.

Path parameters

servicestringrequired

The service ID returned by the billing endpoints.

Body

application/json
pays_from_creditbooleanrequired

The value of pays_from_credit.

Response 200

application/json

The record, as a JSON object. There is no envelope.

service_idintegerrequired

The service id ID.

namestringrequired

The name shown to customers.

hostnamestring | nullrequired

The fully qualified hostname.

statusstring | nullrequired

The value of status.

billing_cyclestring | nullrequired

How often the service renews and is billed.

recurring_amountstring | nullrequired

The amount charged each billing cycle.

currencystring | nullrequired

The three-letter currency code used for monetary amounts.

server_idstring | nullrequired

The server id ID.

next_due_datestring | nullrequired

The value of next_due_date.

periodobject | nullrequired

The value of period.

Show child attributes
starts_atstringrequired

The date and time for starts at, in UTC.

ends_atstringrequired

The date and time for ends at, in UTC.

total_daysintegerrequired

The value of total_days.

days_remainingintegerrequired

The value of days_remaining.

days_overdueintegerrequired

Zero rather than a negative days_remaining, so a caller never has to decide which of the two fields to believe.

remaining_fractionnumberrequired

The share of the period still to run.

statestringrequired

healthy, due_soon, critical or overdue, named on the server so every surface showing a term agrees about when one has become worth worrying about.

autopaybooleanrequired

Whether anything will be charged automatically. The tick or the cross in the Autopay column.

autopay_endingbooleanrequired

Autopay that has been turned off but has not stopped yet. Its own state, drawn between the tick and the cross.

subscriptionobject | nullrequired

The value of subscription.

Show child attributes
uuidstringrequired

The uuid UUID.

uuid_shortstringrequired

The value of uuid_short.

statusstringrequired

The payment provider's current status.

next_charge_atstring | nullrequired

Null once nothing further will be charged, including for a subscription that is merely winding down.

ends_atstring | nullrequired

When an agreed cancellation actually takes effect.

amountstring | nullrequired

Excludes tax.

currencystring | nullrequired

The three-letter currency code used for monetary amounts.

paypal_accountstring | nullrequired

The email address of the saved PayPal account it is charged to, when it is one.

payment_cardstring | nullrequired

The saved card it is charged to, such as "Visa ending 4242", when it is one.

cancellationobject | nullrequired

The value of cancellation.

Show child attributes
requested_atstring | nullrequired

The date and time for requested at, in UTC.

typestring | nullrequired

The type of operation or resource.

type_labelstring | nullrequired

The value of type_label.

reasonstring | nullrequired

The value of reason.

can_start_subscriptionbooleanrequired

Whether the customer can start subscription.

can_cancel_subscriptionbooleanrequired

Whether the customer can cancel subscription.

can_change_cyclebooleanrequired

Whether the customer can change cycle.

can_cancel_servicebooleanrequired

Whether the customer can cancel service.

can_withdraw_cancellationbooleanrequired

Whether the customer can withdraw cancellation.

immediate_refundstring | nullrequired

What stopping this service today would put back on the account, in the currency beside it.

pays_from_creditbooleanrequired

Whether renewals of this service are paid out of the account's credit balance where there is one. True unless the customer has turned it off, which is what the balance does by default.

can_change_creditbooleanrequired

Whether that can be changed from here. False where the installation does not offer account credit at all, or cannot enforce the answer per service.

autopay_providerstring | nullrequired

The value of autopay_provider.

autopay_detailsstring | nullrequired

The value of autopay_details.

suspension_reasonstring | nullrequired

The value of suspension_reason.

autopay_by_accountbooleanrequired

Whether it is charged because automatic payments are on for the whole account, which is where they are turned off.

credit_by_accountbooleanrequired

Whether the credit setting is the account's, chosen on Billing while automatic payments are on for the whole account, rather than this service's own.

postpaid_monthly_pricestring | nullrequired

The value of postpaid_monthly_price.

Errors

401
The key was missing, malformed, revoked, or belongs to an account that no longer exists.
403
Access denied. Check the key's team, permissions and allowed IP addresses. Some actions, such as managing API keys, require a browser session. The response message explains the reason.
404
The resource was not found in the selected team. Resources in another account or team also return 404.
422
A field is missing or invalid, or the resource cannot accept this change in its current state. Check message for details. Field validation also includes an errors object keyed by field name.
429
Too many requests. The Retry-After header says how many seconds to wait. Limits are per account, so several keys on one account share them.