Skip to main content
POST
/
payment_methods
/
{payment_method}
/
detach
Detach a Payment Method
curl --request POST \
  --url https://api.chargeapi.co/v1/payment_methods/{payment_method}/detach \
  --header 'Content-Type: application/json' \
  --data '{
  "driver": "<string>",
  "fleet": "<string>"
}'
{
  "id": "<string>",
  "object": "<string>",
  "bank_account": {
    "bank_name": "<string>",
    "country": "<string>",
    "currency": "<string>",
    "fingerprint": "<string>",
    "last4": "<string>",
    "status": "pending"
  },
  "billing_details": {
    "address": {
      "city": null,
      "country": null,
      "line1": null,
      "line2": null,
      "postal_code": null,
      "state": null
    },
    "email": null,
    "name": null,
    "phone": null
  },
  "card": {
    "brand": "<string>",
    "exp_month": 123,
    "exp_year": 123,
    "fingerprint": "<string>",
    "last4": "<string>"
  },
  "created": 123,
  "driver": "<string>",
  "fleet": "<string>",
  "type": "bank_account",
  "wallet": {
    "balance": 123,
    "currency": "<string>",
    "fingerprint": "<string>",
    "status": "active"
  }
}

Path Parameters

payment_method
string
required

The unique identifier for the Payment Method to detach.

Body

application/json
driver
string

ID of the driver to detach the Payment Method from. Cannot be combined with fleet.

fleet
string

ID of the fleet to detach the Payment Method from. Cannot be combined with driver.

Response

Returns the updated Payment Method object reflecting the detachment. If the Payment Method or target driver or fleet does not exist, an error is returned.

A Payment Method object represents a saved way to pay for charging sessions, such as a credit card. It can be attached to a driver, a fleet, or an account and is used during session billing or reservation fees.

id
string
required

Unique identifier for the Payment Method object.

object
string
required

String representing the object’s type. Always 'payment_method'.

created
integer
required

Time at which the Payment Method was created. Measured in seconds since the Unix epoch.

type
enum<string>
required

The type of the Payment Method. An additional hash is included on the Payment Method with a name matching this value, containing fields specific to that payment method type. For example, if the type is card, the Payment Method will include a card hash with card-specific details.

Available options:
bank_account,
card,
wallet
bank_account
object | null

Present when type is bank_account. Contains bank account-specific details.

billing_details
object

Billing information associated with the Payment Method.

card
object | null

Present when type is card. Contains card-specific details.

driver
string | null

ID of the driver this Payment Method is attached to, if any.

fleet
string | null

ID of the fleet this Payment Method is attached to, if any.

wallet
object | null

Present when type is wallet. Contains wallet-specific details.