Payment Methods

A payment method is a saved card attached to a customer. Cards are collected through a Setup Session (live) or the test-card helper (test mode), then charged synchronously via the Charges API or automatically by Subscriptions.

Use cases: Save a card for future off-session charges, let customers manage their cards from the Billing Portal, or list cards when building your own checkout UI.
GET/v1/payment_methods/:id

Retrieve a saved payment method.

Path Parameters

NameTypeDescription
id
stringrequiredThe payment method id (e.g. pm_WMc9X22NT1af).

Request

curl -X GET "https://api.ching.co.il/v1/payment_methods/:id" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Response

Response
{
  "success": true,
  "data": {
    "id": "pm_WMc9X22NT1af",
    "object": "payment_method",
    "type": "card",
    "status": "active",
    "is_default": true,
    "card": {
      "brand": "visa",
      "last4": "4242",
      "exp_month": 12,
      "exp_year": 2030,
      "issuer_country": "IL",
      "supports_installments": true,
      "supports_recurring": true
    },
    "metadata": {},
    "livemode": false,
    "created": "2026-04-19T09:14:01.000Z"
  }
}
GET/v1/customers/:id/payment_methods

List the customer's active payment methods, newest first.

Path Parameters

NameTypeDescription
id
stringrequiredThe customer id.

Request

curl -X GET "https://api.ching.co.il/v1/customers/:id/payment_methods" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Response

Response
{
  "success": true,
  "data": [
    {
      "id": "pm_WMc9X22NT1af",
      "object": "payment_method",
      "type": "card",
      "status": "active",
      "is_default": true,
      "card": {
        "brand": "visa",
        "last4": "4242",
        "exp_month": 12,
        "exp_year": 2030,
        "issuer_country": "IL",
        "supports_installments": true,
        "supports_recurring": true
      },
      "metadata": {},
      "livemode": false,
      "created": "2026-04-19T09:14:01.000Z"
    }
  ]
}
GET/v1/customers/:id/payment_methods/inactive

List payment methods the customer has detached. Useful for audit trails and for rehydrating history after a customer re-attaches the same card.

Path Parameters

NameTypeDescription
id
stringrequiredThe customer id.

Request

curl -X GET "https://api.ching.co.il/v1/customers/:id/payment_methods/inactive" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Response

Response
{
  "success": true,
  "data": [
    {
      "id": "pm_WMc9X22NT1af",
      "object": "payment_method",
      "type": "card",
      "status": "inactive",
      "is_default": false,
      "card": {
        "brand": "visa",
        "last4": "4242",
        "exp_month": 12,
        "exp_year": 2030,
        "issuer_country": "IL",
        "supports_installments": true,
        "supports_recurring": true
      },
      "metadata": {},
      "livemode": false,
      "created": "2026-04-19T09:14:01.000Z"
    }
  ]
}
POST/v1/payment_methods/:id/detach

Detach a payment method. The card is marked inactive, stops being chargeable, and the customer receives a confirmation email when possible.

If the detached card was the customer's default, the default_payment_method is cleared.

Path Parameters

NameTypeDescription
id
stringrequiredThe payment method id.

Request

curl -X POST "https://api.ching.co.il/v1/payment_methods/:id/detach" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Response

Response
{
  "success": true,
  "data": {
    "id": "pm_WMc9X22NT1af",
    "status": "inactive"
  }
}
POST/v1/payment_methods/test-card

Create a synthetic card for a customer. Use this in test mode to attach a predictable card without running the setup-session flow.

Only available with a test API key (sk_test_...). A live key returns 400.

Body Parameters

NameTypeDescription
customer
stringrequiredThe customer id the card will be attached to.
card_index
numberWhich test card to create. 0 = Visa 4242 (default), 1 = Mastercard 5555, 2 = Amex 0005.

Request

curl -X POST "https://api.ching.co.il/v1/payment_methods/test-card" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "customer": "example_customer",
  "card_index": 0
}'

Response

Response
{
  "success": true,
  "data": {
    "id": "pm_WMc9X22NT1af",
    "object": "payment_method",
    "type": "card",
    "status": "active",
    "is_default": true,
    "card": {
      "brand": "visa",
      "last4": "4242",
      "exp_month": 12,
      "exp_year": 2030,
      "issuer_country": "IL",
      "supports_installments": true,
      "supports_recurring": true
    },
    "metadata": {},
    "livemode": false,
    "created": "2026-04-19T09:14:01.000Z"
  }
}