Skip to content

Pay an invoice with a saved card

POST /api/v2/billing/invoices/{id}/actions/pay

Charge a saved card for an unpaid invoice. Send {} to charge the account’s saved card for the whole balance. An account has one saved card, so savedCardId is optional. Set amount to pay part of the balance. Check actions.canPay and paymentMethods.card on GET /api/v2/billing/invoices/{id} first. When isBulkPaymentChild is true, pay the invoice in bulkPaymentParentId instead. actions.canPay does not block such an invoice today. The amount must be above the card minimum in paymentMethods.card.requirements.minimumAmount and no more than totals.outstanding. Check both before you call. A wrong amount also comes back as payment_failed. The card is charged at once. The response is the updated invoice. A refused charge returns 400 payment_failed with paymentFailure.kind: card_declined, insufficient_funds, card_expired, authentication_required, card_missing or unknown.

Authentication: An API key with the scope write:billing. About keys and scopes

Request

Path parameters

idstringrequired
Public invoice ID from GET /api/v2/billing/invoices (inv_…).

Body (optional)

paymentMethodstring
Always card. Optional. One of card.
savedCardIdstring
The card to charge: primary or a card ID (card_…) from GET /api/v2/billing/payment-methods. Default primary.
amountnumber
Amount to charge in the invoice currency, rounded to two decimals. Default: the whole balance. 0.01 to 1000000.

Example

POST /api/v2/billing/invoices/{id}/actions/pay
curl -X POST "https://cloud.hostup.se/api/v2/billing/invoices/inv_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/pay" \
-H "Authorization: Bearer $HOSTUP_API_KEY" \
-H "Content-Type: application/json"

Responses

200 The updated invoice.

Response 200
{
"id": "inv_01hxa3b4c5d6e7f8g9h0j1k2m3",
"orderId": "ord_01hxa3b4c5d6e7f8g9h0j1k2m3",
"number": "202600001",
"status": "paid",
"dates": {
"issuedAt": "2026-04-27T12:00:00.000Z",
"dueAt": "2026-05-11T23:59:59.000Z",
"paidAt": "2026-04-27T12:10:00.000Z"
},
"totals": {
"currencyCode": "SEK",
"subtotal": 127.2,
"taxAmount": 31.8,
"taxRateDecimal": 0.25,
"creditApplied": 0,
"total": 159,
"amountPaid": 159,
"amountRefunded": 0,
"outstanding": 0
},
"lineItemCount": 1,
"lineItems": [
{
"description": "Cloud VPS monthly service",
"displayDescription": "Cloud VPS monthly service",
"kind": "vps",
"productName": "Cloud VPS",
"quantity": 1,
"unitAmount": 127.2,
"totalAmount": 127.2,
"currencyCode": "SEK",
"period": {
"startAt": "2026-04-27T12:00:00.000Z",
"endAt": "2026-05-27T12:00:00.000Z"
},
"resource": {
"type": "vps",
"id": "vps_01hxa3b4c5d6e7f8g9h0j1k2m3",
"displayName": "example.com"
},
"configurableOptions": [
{
"key": "os",
"label": "OS",
"value": "Debian 13"
},
{
"key": "block_storage",
"label": "Block Storage (NVMe)",
"value": "50 GB"
},
{
"key": "bandwidth_limit",
"label": "Bandwidth limit",
"value": "2 TB"
},
{
"key": "backups",
"label": "Backups",
"value": "7"
}
]
}
],
"payments": [
{
"method": "card",
"methodLabel": "Card",
"amount": 159,
"currencyCode": "SEK"
}
],
"actions": {
"canPay": {
"allowed": false,
"reason": "Invoice is already paid."
},
"canGeneratePaymentLink": {
"allowed": false,
"reason": "Invoice is already paid."
},
"canBulkPay": {
"allowed": false,
"reason": "Invoice is already paid."
},
"canCancel": {
"allowed": false,
"reason": "Only unpaid invoices can be cancelled.",
"code": "invoice_not_unpaid"
},
"canEmail": {
"allowed": true,
"reason": null
},
"canDownload": {
"allowed": true,
"reason": null
},
"canReissueInCurrency": {
"allowed": false,
"reason": "Swedish billing accounts pay SEK invoices by bankgiro, Swish or card.",
"code": "account_country_not_eligible"
}
},
"paymentMethods": {
"card": {
"method": "card",
"label": "Card",
"available": false,
"reason": "Invoice is already paid.",
"checkoutMode": "payment",
"requirements": {
"minimumAmount": {
"amount": 3,
"currencyCode": "SEK",
"comparison": "greater_than"
}
}
},
"accountCredit": {
"method": "accountCredit",
"label": "Account credit",
"available": false,
"reason": "Invoice is already paid.",
"checkoutMode": null,
"requirements": {
"invoiceCurrencyCode": "SEK",
"accountCurrencyCode": "SEK",
"availableBalance": {
"amount": 0,
"currencyCode": "SEK"
},
"maximumAmount": {
"amount": 0,
"currencyCode": "SEK",
"comparison": "less_than_or_equal"
}
}
},
"swish": {
"method": "swish",
"label": "Swish",
"available": false,
"reason": "Invoice is already paid.",
"checkoutMode": null,
"requirements": {
"invoiceCurrencyCode": "SEK",
"accountCountryCode": "SE"
}
},
"bankgiro": {
"method": "bankgiro",
"label": "Bankgiro",
"available": false,
"reason": "Invoice is already paid.",
"checkoutMode": null,
"requirements": {
"invoiceCurrencyCode": "SEK",
"accountCountryCode": "SE"
}
},
"sepa": {
"method": "sepa",
"label": "SEPA bank transfer",
"available": false,
"reason": "Invoice is already paid.",
"checkoutMode": "sepa_bank_transfer_payment",
"requirements": {
"invoiceCurrencyCode": "EUR"
}
},
"alipay": {
"method": "alipay",
"label": "Alipay",
"available": false,
"reason": "Invoice is already paid.",
"checkoutMode": "alipay_payment",
"requirements": {
"invoiceCurrencyCodes": [
"EUR",
"USD"
]
}
},
"crypto": {
"method": "crypto",
"label": "Cryptocurrency",
"available": false,
"reason": "Cryptocurrency payments are not available for Swedish billing accounts.",
"checkoutMode": null,
"requirements": {
"invoiceCurrencyCodes": [
"SEK",
"EUR",
"USD"
],
"accountCountryExcludedCode": "SE",
"accountType": "private",
"requiresCardVerification": true
},
"visible": false
}
},
"paymentLinkGeneratorUrl": null,
"isBulkPaymentChild": false,
"bulkPaymentParentId": null
}
Response fields
idstring
orderIdstring
The order ID (ord_…) when the invoice belongs to an order. A domain renewal invoice whose order is still open is cancelled by cancelling that order first.
numberstring
The invoice number shown to the customer.
statusstring
One of draft, unpaid, partially_paid, paid, cancelled, refunded.
datesobject
issuedAtstring
dueAtstring
paidAtstring
totalsobject
currencyCodestring
subtotalnumber
taxAmountnumber
taxRateDecimalnumber
creditAppliednumber
totalnumber
amountPaidnumber
amountRefundednumber
Total refunded on this invoice. Zero when nothing was refunded.
outstandingnumber
lineItemCountinteger
Number of line items.
lineItemsarray of object
kindstring
What the line is for. One of vps, shared_hosting, domain, addon, credit, setup, other.
purposestring
Why the line was billed. Left out when it is not known. One of renewal, registration, transfer, account_credit_top_up, credit, setup.
resourceobject
The service the line is for. Left out when the line is not for a service.
typestring
One of vps, shared_hosting, domain.
idstring or null
The service’s ID. Null when the line cannot be linked to one.
displayNamestring or null
The service’s name, for display. Null when not known.
productNamestring
The product or plan, when known.
configurableOptionsarray of object
Options ordered with the service, such as OS or disk size. key is the label in lower case with the bracket part dropped and other characters turned into _.
keystring
labelstring
valuestring
descriptionstring
The line text. Left out when the line has none.
displayDescriptionstring
The text to show for the line.
displaySecondaryLinesarray of string
Extra lines to show under displayDescription, such as the period.
monthlyHintstring
detailsHintstring
quantitynumber
unitAmountnumber
Price per unit. Can be negative, for example on a discount line.
totalAmountnumber
currencyCodestring
periodobject
The period the line covers. Left out when not known.
startAtstring
endAtstring
overpaymentCreditobject
Present when the invoice was paid in full twice, once by card and once by bankgiro. The whole extra amount was added to account credit automatically and is still there. It explains the credit. It is not a refund. Other overpayments are not shown here.
decisionstring
One of card_bankgiro_overpayment_already_credited.
currencyCodestring
One of SEK.
invoiceAmountnumber
excessAmountnumber
creditedAtstring
currentCreditBalancenumber
At least 0.
paymentsarray of object
kindstring or null
What the row is. No value or payment: a payment of the invoice. account_credit_added: an overpayment added to account credit, not counted as a payment. refund: money returned (see refundedTo). rounding: a remainder under 1 SEK that Hostup wrote off so the invoice counts as paid. It is not money the customer paid. It is never a refund or a credit movement. One of payment, account_credit_added, refund, rounding.
methodstring or null
The payment method, as a fixed value. Use methodLabel for the text to show. One of card, accountCredit, swish, bankgiro, sepa, alipay, crypto, paypal, invoice, rounding, other.
methodLabelstring or null
The name of the payment method, to show.
amountnumber
currencyCodestring
ISO 4217 currency of amount.
refundedboolean
Present and true on a payment that was later returned. The matching refund row says where the money went.
refundedTostring
Refund rows only. accountCredit: the money is on the account balance and pays the next invoice automatically. paymentMethod: returned to the payment method. unknown: not recorded. One of accountCredit, paymentMethod, unknown.
atstring
The date of this row (ISO 8601), when known.
notestring
actionsobject
canPayobject
allowedboolean
reasonstring or null
codestring or null
A machine-readable code for why the action is blocked.
canGeneratePaymentLinkobject
allowedboolean
reasonstring or null
codestring or null
A machine-readable code for why the action is blocked.
canBulkPayobject
allowedboolean
reasonstring or null
codestring or null
A machine-readable code for why the action is blocked.
canCancelobject
allowedboolean
reasonstring or null
codestring or null
A machine-readable code for why the action is blocked.
canEmailobject
allowedboolean
reasonstring or null
codestring or null
A machine-readable code for why the action is blocked.
canDownloadobject
allowedboolean
reasonstring or null
codestring or null
A machine-readable code for why the action is blocked.
canReissueInCurrencyobject
Whether the account can switch to EUR and get this SEK invoice replaced by an EUR invoice for the same period. SEPA bank transfer is then possible. This is for customers outside Sweden. Do it with POST /api/v2/billing/invoices/{id}/actions/reissue-in-currency. When it is blocked, branch on code: invoice_order_backed (a pending order or plan change backs the invoice: cancel that order, change currency, then order again), invoice_domain_renewal (cancel the renewal order, then renew again), invoice_partially_settled, invoice_multiple_services, invoice_usage_not_reissuable and renewal_period_ended (contact support), account_country_not_eligible (Swedish accounts pay by bankgiro, Swish or card).
allowedboolean
reasonstring or null
codestring or null
A machine-readable code for why the action is blocked.
paymentMethodsobject
Which payment methods can pay this invoice now. The keys include card, accountCredit, swish, bankgiro, sepa, alipay and crypto. Check them before you start a payment.
cardobject
methodstring
The payment method, the same as its key in paymentMethods. Card checkout and wallets are all card. One of card, accountCredit, swish, bankgiro, sepa, alipay, crypto.
labelstring
The method’s name, for display.
availableboolean
visibleboolean
Present for restricted methods. When false, don’t show the method to the customer.
reasonstring or null
Why the method cannot be used, when available is false.
checkoutModestring or null
The kind of hosted checkout the payment session uses. Null for methods without a hosted checkout. One of payment, sepa_bank_transfer_payment, alipay_payment.
requirementsobject
What the payment method needs. Examples: a minimum amount for card, a Swedish account for Swish and bankgiro, EUR for a SEPA bank transfer, an eligible account for cryptocurrency, enough account credit.
invoiceCurrencyCodestring
invoiceCurrencyCodesarray of string
accountCountryCodestring
accountCountryExcludedCodestring
A billing country this method does not accept.
accountTypestring
One of private, organisation.
accountCurrencyCodestring
requiresCardVerificationboolean
Whether a saved card or an earlier successful card payment is needed.
availableBalanceobject
amountnumber
currencyCodestring
minimumAmountobject
amountnumber
currencyCodestring
comparisonstring
How the payment amount must compare with amount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.
maximumAmountobject
amountnumber
currencyCodestring
comparisonstring
How the payment amount must compare with amount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.
accountCreditobject
methodstring
The payment method, the same as its key in paymentMethods. Card checkout and wallets are all card. One of card, accountCredit, swish, bankgiro, sepa, alipay, crypto.
labelstring
The method’s name, for display.
availableboolean
visibleboolean
Present for restricted methods. When false, don’t show the method to the customer.
reasonstring or null
Why the method cannot be used, when available is false.
checkoutModestring or null
The kind of hosted checkout the payment session uses. Null for methods without a hosted checkout. One of payment, sepa_bank_transfer_payment, alipay_payment.
requirementsobject
What the payment method needs. Examples: a minimum amount for card, a Swedish account for Swish and bankgiro, EUR for a SEPA bank transfer, an eligible account for cryptocurrency, enough account credit.
invoiceCurrencyCodestring
invoiceCurrencyCodesarray of string
accountCountryCodestring
accountCountryExcludedCodestring
A billing country this method does not accept.
accountTypestring
One of private, organisation.
accountCurrencyCodestring
requiresCardVerificationboolean
Whether a saved card or an earlier successful card payment is needed.
availableBalanceobject
amountnumber
currencyCodestring
minimumAmountobject
amountnumber
currencyCodestring
comparisonstring
How the payment amount must compare with amount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.
maximumAmountobject
amountnumber
currencyCodestring
comparisonstring
How the payment amount must compare with amount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.
swishobject
methodstring
The payment method, the same as its key in paymentMethods. Card checkout and wallets are all card. One of card, accountCredit, swish, bankgiro, sepa, alipay, crypto.
labelstring
The method’s name, for display.
availableboolean
visibleboolean
Present for restricted methods. When false, don’t show the method to the customer.
reasonstring or null
Why the method cannot be used, when available is false.
checkoutModestring or null
The kind of hosted checkout the payment session uses. Null for methods without a hosted checkout. One of payment, sepa_bank_transfer_payment, alipay_payment.
requirementsobject
What the payment method needs. Examples: a minimum amount for card, a Swedish account for Swish and bankgiro, EUR for a SEPA bank transfer, an eligible account for cryptocurrency, enough account credit.
invoiceCurrencyCodestring
invoiceCurrencyCodesarray of string
accountCountryCodestring
accountCountryExcludedCodestring
A billing country this method does not accept.
accountTypestring
One of private, organisation.
accountCurrencyCodestring
requiresCardVerificationboolean
Whether a saved card or an earlier successful card payment is needed.
availableBalanceobject
amountnumber
currencyCodestring
minimumAmountobject
amountnumber
currencyCodestring
comparisonstring
How the payment amount must compare with amount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.
maximumAmountobject
amountnumber
currencyCodestring
comparisonstring
How the payment amount must compare with amount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.
bankgiroobject
methodstring
The payment method, the same as its key in paymentMethods. Card checkout and wallets are all card. One of card, accountCredit, swish, bankgiro, sepa, alipay, crypto.
labelstring
The method’s name, for display.
availableboolean
visibleboolean
Present for restricted methods. When false, don’t show the method to the customer.
reasonstring or null
Why the method cannot be used, when available is false.
checkoutModestring or null
The kind of hosted checkout the payment session uses. Null for methods without a hosted checkout. One of payment, sepa_bank_transfer_payment, alipay_payment.
requirementsobject
What the payment method needs. Examples: a minimum amount for card, a Swedish account for Swish and bankgiro, EUR for a SEPA bank transfer, an eligible account for cryptocurrency, enough account credit.
invoiceCurrencyCodestring
invoiceCurrencyCodesarray of string
accountCountryCodestring
accountCountryExcludedCodestring
A billing country this method does not accept.
accountTypestring
One of private, organisation.
accountCurrencyCodestring
requiresCardVerificationboolean
Whether a saved card or an earlier successful card payment is needed.
availableBalanceobject
amountnumber
currencyCodestring
minimumAmountobject
amountnumber
currencyCodestring
comparisonstring
How the payment amount must compare with amount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.
maximumAmountobject
amountnumber
currencyCodestring
comparisonstring
How the payment amount must compare with amount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.
sepaobject
methodstring
The payment method, the same as its key in paymentMethods. Card checkout and wallets are all card. One of card, accountCredit, swish, bankgiro, sepa, alipay, crypto.
labelstring
The method’s name, for display.
availableboolean
visibleboolean
Present for restricted methods. When false, don’t show the method to the customer.
reasonstring or null
Why the method cannot be used, when available is false.
checkoutModestring or null
The kind of hosted checkout the payment session uses. Null for methods without a hosted checkout. One of payment, sepa_bank_transfer_payment, alipay_payment.
requirementsobject
What the payment method needs. Examples: a minimum amount for card, a Swedish account for Swish and bankgiro, EUR for a SEPA bank transfer, an eligible account for cryptocurrency, enough account credit.
invoiceCurrencyCodestring
invoiceCurrencyCodesarray of string
accountCountryCodestring
accountCountryExcludedCodestring
A billing country this method does not accept.
accountTypestring
One of private, organisation.
accountCurrencyCodestring
requiresCardVerificationboolean
Whether a saved card or an earlier successful card payment is needed.
availableBalanceobject
amountnumber
currencyCodestring
minimumAmountobject
amountnumber
currencyCodestring
comparisonstring
How the payment amount must compare with amount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.
maximumAmountobject
amountnumber
currencyCodestring
comparisonstring
How the payment amount must compare with amount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.
alipayobject
methodstring
The payment method, the same as its key in paymentMethods. Card checkout and wallets are all card. One of card, accountCredit, swish, bankgiro, sepa, alipay, crypto.
labelstring
The method’s name, for display.
availableboolean
visibleboolean
Present for restricted methods. When false, don’t show the method to the customer.
reasonstring or null
Why the method cannot be used, when available is false.
checkoutModestring or null
The kind of hosted checkout the payment session uses. Null for methods without a hosted checkout. One of payment, sepa_bank_transfer_payment, alipay_payment.
requirementsobject
What the payment method needs. Examples: a minimum amount for card, a Swedish account for Swish and bankgiro, EUR for a SEPA bank transfer, an eligible account for cryptocurrency, enough account credit.
invoiceCurrencyCodestring
invoiceCurrencyCodesarray of string
accountCountryCodestring
accountCountryExcludedCodestring
A billing country this method does not accept.
accountTypestring
One of private, organisation.
accountCurrencyCodestring
requiresCardVerificationboolean
Whether a saved card or an earlier successful card payment is needed.
availableBalanceobject
amountnumber
currencyCodestring
minimumAmountobject
amountnumber
currencyCodestring
comparisonstring
How the payment amount must compare with amount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.
maximumAmountobject
amountnumber
currencyCodestring
comparisonstring
How the payment amount must compare with amount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.
cryptoobject
methodstring
The payment method, the same as its key in paymentMethods. Card checkout and wallets are all card. One of card, accountCredit, swish, bankgiro, sepa, alipay, crypto.
labelstring
The method’s name, for display.
availableboolean
visibleboolean
Present for restricted methods. When false, don’t show the method to the customer.
reasonstring or null
Why the method cannot be used, when available is false.
checkoutModestring or null
The kind of hosted checkout the payment session uses. Null for methods without a hosted checkout. One of payment, sepa_bank_transfer_payment, alipay_payment.
requirementsobject
What the payment method needs. Examples: a minimum amount for card, a Swedish account for Swish and bankgiro, EUR for a SEPA bank transfer, an eligible account for cryptocurrency, enough account credit.
invoiceCurrencyCodestring
invoiceCurrencyCodesarray of string
accountCountryCodestring
accountCountryExcludedCodestring
A billing country this method does not accept.
accountTypestring
One of private, organisation.
accountCurrencyCodestring
requiresCardVerificationboolean
Whether a saved card or an earlier successful card payment is needed.
availableBalanceobject
amountnumber
currencyCodestring
minimumAmountobject
amountnumber
currencyCodestring
comparisonstring
How the payment amount must compare with amount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.
maximumAmountobject
amountnumber
currencyCodestring
comparisonstring
How the payment amount must compare with amount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.
paymentLinkGeneratorUrlstring or null
Path to POST to for a payment link (POST /api/v2/billing/invoices/{id}/actions/generate-payment-link). Null when actions.canGeneratePaymentLink.allowed is false.
isBulkPaymentChildboolean
True when another invoice pays this one together with others. Pay bulkPaymentParentId instead. actions.canPay can still be allowed on such an invoice.
bulkPaymentParentIdstring or null
The invoice that pays this one together with others. Null when isBulkPaymentChild is false.
coversInvoiceIdsarray of string
On an invoice that pays several invoices at once: the invoices it pays. Absent on other invoices.
renewalInvoicingobject
How the account groups its renewal invoices. Present only on the invoice detail, for a renewal invoice Hostup created automatically.
preferencestring
One of consolidated, separate.
generatedByAutomationboolean
True when Hostup created the invoice automatically for a renewal.
isConsolidatedboolean
True when this is an automatic renewal invoice and the account’s setting is to put renewals on one invoice.
labelstring
settingsUrlstring
deliveryobject
Present only when the invoice is sent as a Peppol e-invoice. Absent for other invoices.
channelstring
One of peppol.
statusstring
queued: accepted for sending and waiting, for example for the send window. An unpaid invoice from today for an organisation registered in Peppol is also queued until it is sent. sent: sent into the Peppol network. delivered: the recipient’s access point confirmed receipt. A failed or ineligible delivery never shows here. Such an invoice has no delivery field. One of queued, sent, delivered.
sentAtstring or null
When the e-invoice was sent into the Peppol network. Null while it is queued.
deliveredAtstring or null
When the recipient’s access point confirmed receipt. Null until then.
cancellationobject
Why the invoice was cancelled. Present only on a cancelled invoice whose reason is known. Only the invoice detail has it. List items never do.
codestring
A fixed value. domain_registered_elsewhere: an unpaid order for a new domain registration was cancelled automatically. Someone else registered the name before the invoice was paid. A new domain is registered only once its invoice is paid. The name was never on this account and nothing was charged. One of domain_registered_elsewhere.
reasonstring
The explanation, in English. Use code to branch or to pick a translated text.
domainNamestring
The domain name that was ordered.
registrarNamestring or null
The registrar the name is now registered through, as the registry publishes it. null when unknown.
registeredAtstring or null
When the other registration was made at the registry (to the day, at midnight UTC). null when unknown.
cancelledAtstring or null
When the order and invoice were cancelled. It comes after registeredAt, since the cancellation follows that registration.

Errors

Errors are Problem Details with a stable code. Branch on the code, not on the text.

400invalid_request: the body is wrong. Causes: an unknown field; a paymentMethod other than card; a savedCardId that is neither primary nor one of the account’s card IDs; an amount that is not a positive number up to 1000000. The error points at /paymentMethod whichever field is wrong. detail lists the rules for all three fields. payment_failed: nothing was charged. The card was refused (paymentFailure.kind says why). It also comes back, with paymentFailure.kind unknown, in these cases: amount is more than the balance; the amount (or the whole balance) is at or below paymentMethods.card.requirements.minimumAmount; the invoice is in debt collection. Show detail to the payer. Do not retry in a loop.
401Unauthorized. Authentication is required.
403forbidden: the API key lacks write:billing. requiredScopes names it. The same code comes back when the account is not active.
404Not found. The resource does not exist or is not owned by the caller; code is invoice_not_found.
409The invoice cannot be charged now. invoice_already_paid: it is already paid. invoice_not_payable: it is not unpaid or has nothing left to pay. payment_method_invalid: no saved card was found. paymentLinkGeneratorUrl then points to a payment link instead. invoice_payment_in_progress: another payment for the invoice is running. payment_failed: the invoice changed while the payment was being prepared. Nothing was charged. Read the invoice again, then retry.
429Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers.
500Internal error. Retry later or contact support if the issue persists.
502upstream_invoice_shape_invalid: the card was charged, but the updated invoice could not be loaded. Do not pay again. Read the invoice with GET /api/v2/billing/invoices/{id}?skipCache=1.
503payment_failed: the payment could not be started. Nothing was charged. Retry later.