Skip to content
Hayonix

API reference · Billing

Remove a saved card (turns off auto-recharge if it used this card)

POST/v1/orgs/{org_id}/billing/payment-methods/{payment_method_id}/detach
Console sessionbilling:manageOrganization

The card is removed from the payment processor and never charged again. Removing a card that is already removed returns it unchanged.

Console session only: no API key can be granted the billing:manage permission it needs. Requires the billing:manage permission (a key's scope, or a role that includes it).

Request

Path parameters

  • org_idstring

    Your organization. The SDKs and the CLI fill it in from the API key.

    ID with prefix org_

  • payment_method_idstringrequired

    ID of the payment method

    ID with prefix pmth_

Response

200 PaymentMethod — The removed card

  • objectstringrequired

    Always `payment_method`: the type of this object

    One ofpayment_method

  • idstringrequired

    Unique ID (`pmth_…`)

    ID with prefix pmth_

  • org_idstringrequired

    Organization it belongs to

    ID with prefix org_

  • driverstringrequired

    `stripe` for a card saved with the payment processor, `development` for a test card that takes no money

    One ofstripedevelopment

  • brandstring | nullrequired

    Card brand, for example `visa`; null when unknown

  • last4string | nullrequired

    Last four digits of the card; null when unknown

  • exp_monthinteger | nullrequired

    Expiry month (1–12); null when unknown

  • exp_yearinteger | nullrequired

    Expiry year (four digits); null when unknown

  • statusstringrequired

    `active` (can be charged) or `detached` (removed; never charged again)

    One ofactivedetached

  • created_atstring (date-time)required

    When it was created (ISO 8601, UTC)

Example response
Example response
{
  "object": "payment_method",
  "id": "pmth_01jc5zq4m8k3v6x9t2w7r0b1e4",
  "org_id": "org_01jc5zq4m8k3v6x9t2w7r0b1e4",
  "driver": "stripe",
  "brand": "string",
  "last4": "string",
  "exp_month": 1,
  "exp_year": 1,
  "status": "active",
  "created_at": "2026-01-01T00:00:00.000Z"
}

Errors

Errors use the standard envelope. What this operation can answer:

Errors
StatusTypeWhen
400invalid_request_errorA parameter or body field is missing or not allowed; param names it.
401authentication_errorThe key or session is missing, revoked or expired.
403permission_errorThe credential lacks the permission this needs, or the organization is suspended.
404not_found_errorNo such resource in this project (an ID from another project is answered the same way).
409conflict_errorThe resource's current state does not allow this.
429rate_limit_error rate_limitedToo many requests; retry after retry-after seconds.