API reference

Payment Methods

PaymentMethod objects represent your customer's payment instruments. You can use them with PaymentIntents to collect payments or save them to Customer objects to store instrument details for future payments. Related guides: Payment Methods and More Payment Scenarios.

Knox answers these operations with the same requests and responses as Stripe's API. Authenticate with your secret key, Authorization: Bearer sk_test_..., from your server, and send form-encoded bodies. Test mode only: live processing is currently disabled.

Create a PaymentMethod

POST/v1/payment_methods

Creates a PaymentMethod object. Read the Stripe.js reference to learn how to create PaymentMethods via Stripe.js. Instead of creating a PaymentMethod directly, we recommend using the PaymentIntents API to accept a payment immediately or the SetupIntent API to collect payment method details ahead of a future payment.

Body parameters

  • acss_debitobject

    If this is an acss_debit PaymentMethod, this hash contains details about the ACSS Debit payment method.

    Show 3 child parameters
    • account_numberstringRequired
    • institution_numberstringRequired
    • transit_numberstringRequired
  • affirmobject

    If this is an affirm PaymentMethod, this hash contains details about the Affirm payment method.

  • afterpay_clearpayobject

    If this is an AfterpayClearpay PaymentMethod, this hash contains details about the AfterpayClearpay payment method.

  • alipayobject

    If this is an Alipay PaymentMethod, this hash contains details about the Alipay payment method.

  • allow_redisplaystring

    This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. The field defaults to unspecified.

    Possible values
    • always
    • limited
    • unspecified
  • almaobject

    If this is a Alma PaymentMethod, this hash contains details about the Alma payment method.

  • amazon_payobject

    If this is a AmazonPay PaymentMethod, this hash contains details about the AmazonPay payment method.

  • au_becs_debitobject

    If this is an au_becs_debit PaymentMethod, this hash contains details about the bank account.

    Show 2 child parameters
    • account_numberstringRequired
    • bsb_numberstringRequired
  • bacs_debitobject

    If this is a bacs_debit PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.

    Show 2 child parameters
    • account_numberstring
    • sort_codestring
  • bancontactobject

    If this is a bancontact PaymentMethod, this hash contains details about the Bancontact payment method.

  • billieobject

    If this is a billie PaymentMethod, this hash contains details about the Billie payment method.

  • billing_detailsobject

    Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.

    Show 5 child parameters
    • addressobject
      Show 6 child parameters
      • citystring
      • countrystring
      • line1string
      • line2string
      • postal_codestring
      • statestring
    • emailstring
    • namestring
    • phonestring
    • tax_idstring
  • bizumobject

    If this is a bizum PaymentMethod, this hash contains details about the Bizum payment method.

  • blikobject

    If this is a blik PaymentMethod, this hash contains details about the BLIK payment method.

  • boletoobject

    If this is a boleto PaymentMethod, this hash contains details about the Boleto payment method.

    Show 1 child parameter
    • tax_idstringRequired
  • cardobject

    If this is a card PaymentMethod, this hash contains the user's card details. For backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, Amex Express Checkout, or legacy Checkout) into the card hash with format card: {token: "tok_visa"}. When providing a card number, you must meet the requirements for PCI compliance. We strongly recommend using Stripe.js instead of interacting with this API directly.

    Show 5 child parameters
    • exp_monthintegerRequired
    • exp_yearintegerRequired
    • numberstringRequired
    • cvcstring
    • networksobject
      Show 1 child parameter
      • preferredstring
        Possible values
        • cartes_bancaires
        • mastercard
        • visa
  • cashappobject

    If this is a cashapp PaymentMethod, this hash contains details about the Cash App Pay payment method.

  • cryptoobject

    If this is a Crypto PaymentMethod, this hash contains details about the Crypto payment method.

  • customobject

    If this is a custom PaymentMethod, this hash contains details about the Custom payment method.

    Show 1 child parameter
    • typestringRequired
  • customerstring

    The Customer to whom the original PaymentMethod is attached.

  • customer_balanceobject

    If this is a customer_balance PaymentMethod, this hash contains details about the CustomerBalance payment method.

  • epsobject

    If this is an eps PaymentMethod, this hash contains details about the EPS payment method.

    Show 1 child parameter
    • bankstring
      Possible values
      • arzte_und_apotheker_bank
      • austrian_anadi_bank_ag
      • bank_austria
      • bankhaus_carl_spangler
      • bankhaus_schelhammer_und_schattera_ag
      • bawag_psk_ag
      • bks_bank_ag
      • brull_kallmus_bank_ag
      • btv_vier_lander_bank
      • capital_bank_grawe_gruppe_ag
      • deutsche_bank_ag
      • dolomitenbank
      • easybank_ag
      • erste_bank_und_sparkassen
      • hypo_alpeadriabank_international_ag
      • hypo_bank_burgenland_aktiengesellschaft
      • and 12 more
  • expandarray of strings

    Specifies which fields in the response should be expanded.

  • fpxobject

    If this is an fpx PaymentMethod, this hash contains details about the FPX payment method.

    Show 1 child parameter
    • bankstringRequired
      Possible values
      • affin_bank
      • agrobank
      • alliance_bank
      • ambank
      • bank_islam
      • bank_muamalat
      • bank_of_china
      • bank_rakyat
      • bnp_paribas
      • bsn
      • cimb
      • citibank
      • deutsche_bank
      • hong_leong_bank
      • hsbc
      • kfh
      • and 9 more
  • giropayobject

    If this is a giropay PaymentMethod, this hash contains details about the Giropay payment method.

  • grabpayobject

    If this is a grabpay PaymentMethod, this hash contains details about the GrabPay payment method.

  • idealobject

    If this is an ideal PaymentMethod, this hash contains details about the iDEAL payment method.

    Show 1 child parameter
    • bankstring
      Possible values
      • abn_amro
      • adyen
      • asn_bank
      • bunq
      • buut
      • finom
      • handelsbanken
      • ing
      • knab
      • mollie
      • moneyou
      • n26
      • nn
      • rabobank
      • regiobank
      • revolut
      • and 4 more
  • interac_presentobject

    If this is an interac_present PaymentMethod, this hash contains details about the Interac Present payment method.

  • kakao_payobject

    If this is a kakao_pay PaymentMethod, this hash contains details about the Kakao Pay payment method.

  • klarnaobject

    If this is a klarna PaymentMethod, this hash contains details about the Klarna payment method.

    Show 1 child parameter
    • dobobject
      Show 3 child parameters
      • dayintegerRequired
      • monthintegerRequired
      • yearintegerRequired
  • konbiniobject

    If this is a konbini PaymentMethod, this hash contains details about the Konbini payment method.

  • kr_cardobject

    If this is a kr_card PaymentMethod, this hash contains details about the Korean Card payment method.

  • linkobject

    If this is an Link PaymentMethod, this hash contains details about the Link payment method (Link is also known as Onelink in the UK).

  • mb_wayobject

    If this is a MB WAY PaymentMethod, this hash contains details about the MB WAY payment method.

  • metadataobject

    Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

  • mobilepayobject

    If this is a mobilepay PaymentMethod, this hash contains details about the MobilePay payment method.

  • multibancoobject

    If this is a multibanco PaymentMethod, this hash contains details about the Multibanco payment method.

  • naver_payobject

    If this is a naver_pay PaymentMethod, this hash contains details about the Naver Pay payment method.

    Show 1 child parameter
    • fundingstring
      Possible values
      • card
      • points
  • nz_bank_accountobject

    If this is an nz_bank_account PaymentMethod, this hash contains details about the nz_bank_account payment method.

    Show 6 child parameters
    • account_numberstringRequired
    • bank_codestringRequired
    • branch_codestringRequired
    • suffixstringRequired
    • account_holder_namestring
    • referencestring
  • oxxoobject

    If this is an oxxo PaymentMethod, this hash contains details about the OXXO payment method.

  • p24object

    If this is a p24 PaymentMethod, this hash contains details about the P24 payment method.

    Show 1 child parameter
    • bankstring
      Possible values
      • alior_bank
      • bank_millennium
      • bank_nowy_bfg_sa
      • bank_pekao_sa
      • banki_spbdzielcze
      • blik
      • bnp_paribas
      • boz
      • citi_handlowy
      • credit_agricole
      • envelobank
      • etransfer_pocztowy24
      • getin_bank
      • ideabank
      • ing
      • inteligo
      • and 10 more
  • pay_by_bankobject

    If this is a pay_by_bank PaymentMethod, this hash contains details about the PayByBank payment method.

  • paycoobject

    If this is a payco PaymentMethod, this hash contains details about the PAYCO payment method.

  • payment_methodstring

    The PaymentMethod to share.

  • paynowobject

    If this is a paynow PaymentMethod, this hash contains details about the PayNow payment method.

  • paypalobject

    If this is a paypal PaymentMethod, this hash contains details about the PayPal payment method.

  • paytoobject

    If this is a payto PaymentMethod, this hash contains details about the PayTo payment method.

    Show 3 child parameters
    • account_numberstring
    • bsb_numberstring
    • pay_idstring
  • pixobject

    If this is a pix PaymentMethod, this hash contains details about the Pix payment method.

  • promptpayobject

    If this is a promptpay PaymentMethod, this hash contains details about the PromptPay payment method.

  • radar_optionsobject

    Options to configure Radar. See Radar Session for more information.

    Show 1 child parameter
    • sessionstring
  • revolut_payobject

    If this is a revolut_pay PaymentMethod, this hash contains details about the Revolut Pay payment method.

  • samsung_payobject

    If this is a samsung_pay PaymentMethod, this hash contains details about the SamsungPay payment method.

  • satispayobject

    If this is a satispay PaymentMethod, this hash contains details about the Satispay payment method.

  • scalapayobject

    If this is a Scalapay PaymentMethod, this hash contains details about the Scalapay payment method.

  • sepa_debitobject

    If this is a sepa_debit PaymentMethod, this hash contains details about the SEPA debit bank account.

    Show 1 child parameter
    • ibanstringRequired
  • sofortobject

    If this is a sofort PaymentMethod, this hash contains details about the SOFORT payment method.

    Show 1 child parameter
    • countrystringRequired
      Possible values
      • AT
      • BE
      • DE
      • ES
      • IT
      • NL
  • sunbitobject

    If this is a sunbit PaymentMethod, this hash contains details about the Sunbit payment method.

  • swishobject

    If this is a swish PaymentMethod, this hash contains details about the Swish payment method.

  • twintobject

    If this is a TWINT PaymentMethod, this hash contains details about the TWINT payment method.

  • typestring

    The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type.

    Possible values
    • acss_debit
    • affirm
    • afterpay_clearpay
    • alipay
    • alma
    • amazon_pay
    • au_becs_debit
    • bacs_debit
    • bancontact
    • billie
    • bizum
    • blik
    • boleto
    • card
    • cashapp
    • crypto
    • and 39 more
  • upiobject

    If this is a upi PaymentMethod, this hash contains details about the UPI payment method.

    Show 1 child parameter
    • mandate_optionsobject
      Show 4 child parameters
      • amountinteger
      • amount_typestring
        Possible values
        • fixed
        • maximum
      • descriptionstring
      • end_dateinteger
  • us_bank_accountobject

    If this is an us_bank_account PaymentMethod, this hash contains details about the US bank account payment method.

    Show 5 child parameters
    • account_holder_typestring
      Possible values
      • company
      • individual
    • account_numberstring
    • account_typestring
      Possible values
      • checking
      • savings
    • financial_connections_accountstring
    • routing_numberstring
  • wechat_payobject

    If this is an wechat_pay PaymentMethod, this hash contains details about the wechat_pay payment method.

  • zipobject

    If this is a zip PaymentMethod, this hash contains details about the Zip payment method.

Returns

The payment_method object.

POST /v1/payment_methods
curl -X POST https://api.knoxapi.com/v1/payment_methods \
  -H "Authorization: Bearer $KNOX_SECRET_KEY"
Response
{
  "allow_redisplay": "unspecified",
  "billing_details": {
    "address": {
      "city": "San Francisco",
      "country": "US",
      "line1": "1234 Fake Street",
      "line2": null,
      "postal_code": "94102",
      "state": "CA"
    },
    "email": "[email protected]",
    "name": null,
    "phone": "+15555555555",
    "tax_id": null
  },
  "card": {
    "brand": "visa",
    "checks": {
      "address_line1_check": null,
      "address_postal_code_check": null,
      "cvc_check": "pass"
    },
    "country": "US",
    "display_brand": "visa",
    "exp_month": 8,
    "exp_year": 2030,
    "fingerprint": "AOB934RVNwzk6xtn",
    "funding": "credit",
    "generated_from": {
      "charge": null,
      "payment_method_details": {
        "type": "type"
      },
      "setup_attempt": null
    },
    "last4": "4242",
    "networks": {
      "available": [
        "visa"
      ],
      "preferred": null
    },
    "three_d_secure_usage": {
      "supported": true
    },
    "wallet": {
      "dynamic_last4": null,
      "type": "link"
    },
    "regulated_status": null
  },
  "created": 1234567890,
  "customer": null,
  "id": "pm_1Pgc75B7WZ01zgkWlHVgdEGJ",
  "livemode": false,
  "metadata": {
    "order_id": "123456789"
  },
  "object": "payment_method",
  "type": "card",
  "customer_account": null
}

List PaymentMethods

GET/v1/payment_methods

Returns a list of all PaymentMethods.

Query parameters

  • allow_redisplaystring

    This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.

    Possible values
    • always
    • limited
    • unspecified
  • customerstring

    The ID of the customer whose PaymentMethods will be retrieved.

  • customer_accountstring

    The ID of the Account whose PaymentMethods will be retrieved.

  • ending_beforestring

    A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list.

  • expandarray of strings

    Specifies which fields in the response should be expanded.

  • limitinteger

    A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.

  • starting_afterstring

    A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list.

  • typestring

    Filters the list by the object type field. Unfiltered, the list returns all payment method types except custom. If your integration expects only one type of payment method in the response, specify that type value in the request to reduce your payload.

    Possible values
    • acss_debit
    • affirm
    • afterpay_clearpay
    • alipay
    • alma
    • amazon_pay
    • au_becs_debit
    • bacs_debit
    • bancontact
    • billie
    • bizum
    • blik
    • boleto
    • card
    • cashapp
    • crypto
    • and 39 more

Returns

A list of payment_method objects.

GET /v1/payment_methods
curl -G https://api.knoxapi.com/v1/payment_methods \
  -H "Authorization: Bearer $KNOX_SECRET_KEY" \
  --data-urlencode limit=3
Response
{
  "object": "list",
  "url": "/v1/payment_methods",
  "has_more": false,
  "data": [
    {
      "allow_redisplay": "unspecified",
      "billing_details": {
        "address": {
          "city": "San Francisco",
          "country": "US",
          "line1": "1234 Fake Street",
          "line2": null,
          "postal_code": "94102",
          "state": "CA"
        },
        "email": "[email protected]",
        "name": null,
        "phone": "+15555555555",
        "tax_id": null
      },
      "card": {
        "brand": "visa",
        "checks": {
          "address_line1_check": null,
          "address_postal_code_check": null,
          "cvc_check": "pass"
        },
        "country": "US",
        "display_brand": "visa",
        "exp_month": 8,
        "exp_year": 2030,
        "fingerprint": "AOB934RVNwzk6xtn",
        "funding": "credit",
        "generated_from": {
          "charge": null,
          "payment_method_details": {
            "type": "type"
          },
          "setup_attempt": null
        },
        "last4": "4242",
        "networks": {
          "available": [
            "visa"
          ],
          "preferred": null
        },
        "three_d_secure_usage": {
          "supported": true
        },
        "wallet": {
          "dynamic_last4": null,
          "type": "link"
        },
        "regulated_status": null
      },
      "created": 1234567890,
      "customer": null,
      "id": "pm_1Pgc75B7WZ01zgkWlHVgdEGJ",
      "livemode": false,
      "metadata": {
        "order_id": "123456789"
      },
      "object": "payment_method",
      "type": "card",
      "customer_account": null
    }
  ]
}

Update a PaymentMethod

POST/v1/payment_methods/{payment_method}

Updates a PaymentMethod object. A PaymentMethod must be attached to a customer to be updated.

Path parameters

  • payment_methodstringRequired

Body parameters

  • allow_redisplaystring

    This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. The field defaults to unspecified.

    Possible values
    • always
    • limited
    • unspecified
  • billing_detailsobject

    Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.

    Show 5 child parameters
    • addressobject
      Show 6 child parameters
      • citystring
      • countrystring
      • line1string
      • line2string
      • postal_codestring
      • statestring
    • emailstring
    • namestring
    • phonestring
    • tax_idstring
  • cardobject

    If this is a card PaymentMethod, this hash contains the user's card details.

    Show 3 child parameters
    • exp_monthinteger
    • exp_yearinteger
    • networksobject
      Show 1 child parameter
      • preferredstring
        Possible values
        • cartes_bancaires
        • mastercard
        • visa
  • expandarray of strings

    Specifies which fields in the response should be expanded.

  • metadataobject

    Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

  • paytoobject

    If this is a payto PaymentMethod, this hash contains details about the PayTo payment method.

    Show 3 child parameters
    • account_numberstring
    • bsb_numberstring
    • pay_idstring
  • us_bank_accountobject

    If this is an us_bank_account PaymentMethod, this hash contains details about the US bank account payment method.

    Show 2 child parameters
    • account_holder_typestring
      Possible values
      • company
      • individual
    • account_typestring
      Possible values
      • checking
      • savings

Returns

The payment_method object.

POST /v1/payment_methods/{payment_method}
curl https://api.knoxapi.com/v1/payment_methods/pm_1Pgc75B7WZ01zgkWlHVgdEGJ \
  -H "Authorization: Bearer $KNOX_SECRET_KEY" \
  -d "metadata[order_id]=6735"
Response
{
  "allow_redisplay": "unspecified",
  "billing_details": {
    "address": {
      "city": "San Francisco",
      "country": "US",
      "line1": "1234 Fake Street",
      "line2": null,
      "postal_code": "94102",
      "state": "CA"
    },
    "email": "[email protected]",
    "name": null,
    "phone": "+15555555555",
    "tax_id": null
  },
  "card": {
    "brand": "visa",
    "checks": {
      "address_line1_check": null,
      "address_postal_code_check": null,
      "cvc_check": "pass"
    },
    "country": "US",
    "display_brand": "visa",
    "exp_month": 8,
    "exp_year": 2030,
    "fingerprint": "AOB934RVNwzk6xtn",
    "funding": "credit",
    "generated_from": {
      "charge": null,
      "payment_method_details": {
        "type": "type"
      },
      "setup_attempt": null
    },
    "last4": "4242",
    "networks": {
      "available": [
        "visa"
      ],
      "preferred": null
    },
    "three_d_secure_usage": {
      "supported": true
    },
    "wallet": {
      "dynamic_last4": null,
      "type": "link"
    },
    "regulated_status": null
  },
  "created": 1234567890,
  "customer": null,
  "id": "pm_1Pgc75B7WZ01zgkWlHVgdEGJ",
  "livemode": false,
  "metadata": {
    "order_id": "123456789"
  },
  "object": "payment_method",
  "type": "card",
  "customer_account": null
}

Retrieve a PaymentMethod

GET/v1/payment_methods/{payment_method}

Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method attached to a Customer, you should use Retrieve a Customer’s PaymentMethods

Path parameters

  • payment_methodstringRequired

Query parameters

  • expandarray of strings

    Specifies which fields in the response should be expanded.

Returns

The payment_method object.

GET /v1/payment_methods/{payment_method}
curl https://api.knoxapi.com/v1/payment_methods/pm_1Pgc75B7WZ01zgkWlHVgdEGJ \
  -H "Authorization: Bearer $KNOX_SECRET_KEY"
Response
{
  "allow_redisplay": "unspecified",
  "billing_details": {
    "address": {
      "city": "San Francisco",
      "country": "US",
      "line1": "1234 Fake Street",
      "line2": null,
      "postal_code": "94102",
      "state": "CA"
    },
    "email": "[email protected]",
    "name": null,
    "phone": "+15555555555",
    "tax_id": null
  },
  "card": {
    "brand": "visa",
    "checks": {
      "address_line1_check": null,
      "address_postal_code_check": null,
      "cvc_check": "pass"
    },
    "country": "US",
    "display_brand": "visa",
    "exp_month": 8,
    "exp_year": 2030,
    "fingerprint": "AOB934RVNwzk6xtn",
    "funding": "credit",
    "generated_from": {
      "charge": null,
      "payment_method_details": {
        "type": "type"
      },
      "setup_attempt": null
    },
    "last4": "4242",
    "networks": {
      "available": [
        "visa"
      ],
      "preferred": null
    },
    "three_d_secure_usage": {
      "supported": true
    },
    "wallet": {
      "dynamic_last4": null,
      "type": "link"
    },
    "regulated_status": null
  },
  "created": 1234567890,
  "customer": null,
  "id": "pm_1Pgc75B7WZ01zgkWlHVgdEGJ",
  "livemode": false,
  "metadata": {
    "order_id": "123456789"
  },
  "object": "payment_method",
  "type": "card",
  "customer_account": null
}

Attach a PaymentMethod to a Customer

POST/v1/payment_methods/{payment_method}/attach

Attaches a PaymentMethod object to a Customer. To attach a new PaymentMethod to a customer for future payments, we recommend you use a SetupIntent or a PaymentIntent with setup_future_usage. These approaches will perform any necessary steps to set up the PaymentMethod for future payments. Using the /v1/payment_methods/:id/attach endpoint without first using a SetupIntent or PaymentIntent with setup_future_usage does not optimize the PaymentMethod for future use, which makes later declines and payment friction more likely. See Optimizing cards for future payments for more information about setting up future payments. To use this PaymentMethod as the default for invoice or subscription payments, set invoice_settings.default_payment_method, on the Customer to the PaymentMethod’s ID.

Path parameters

  • payment_methodstringRequired

Body parameters

  • customerstring

    The ID of the customer to which to attach the PaymentMethod.

  • customer_accountstring

    The ID of the Account representing the customer to which to attach the PaymentMethod.

  • expandarray of strings

    Specifies which fields in the response should be expanded.

Returns

The payment_method object.

POST /v1/payment_methods/{payment_method}/attach
curl -X POST https://api.knoxapi.com/v1/payment_methods/pm_1Pgc75B7WZ01zgkWlHVgdEGJ/attach \
  -H "Authorization: Bearer $KNOX_SECRET_KEY"
Response
{
  "allow_redisplay": "unspecified",
  "billing_details": {
    "address": {
      "city": "San Francisco",
      "country": "US",
      "line1": "1234 Fake Street",
      "line2": null,
      "postal_code": "94102",
      "state": "CA"
    },
    "email": "[email protected]",
    "name": null,
    "phone": "+15555555555",
    "tax_id": null
  },
  "card": {
    "brand": "visa",
    "checks": {
      "address_line1_check": null,
      "address_postal_code_check": null,
      "cvc_check": "pass"
    },
    "country": "US",
    "display_brand": "visa",
    "exp_month": 8,
    "exp_year": 2030,
    "fingerprint": "AOB934RVNwzk6xtn",
    "funding": "credit",
    "generated_from": {
      "charge": null,
      "payment_method_details": {
        "type": "type"
      },
      "setup_attempt": null
    },
    "last4": "4242",
    "networks": {
      "available": [
        "visa"
      ],
      "preferred": null
    },
    "three_d_secure_usage": {
      "supported": true
    },
    "wallet": {
      "dynamic_last4": null,
      "type": "link"
    },
    "regulated_status": null
  },
  "created": 1234567890,
  "customer": null,
  "id": "pm_1Pgc75B7WZ01zgkWlHVgdEGJ",
  "livemode": false,
  "metadata": {
    "order_id": "123456789"
  },
  "object": "payment_method",
  "type": "card",
  "customer_account": null
}

Detach a PaymentMethod from a Customer

POST/v1/payment_methods/{payment_method}/detach

Detaches a PaymentMethod object from a Customer. Detachment is permanent and irreversible — once detached, a PaymentMethod can no longer be used for payments or re-attached to a Customer.

Path parameters

  • payment_methodstringRequired

Body parameters

  • expandarray of strings

    Specifies which fields in the response should be expanded.

Returns

The payment_method object.

POST /v1/payment_methods/{payment_method}/detach
curl -X POST https://api.knoxapi.com/v1/payment_methods/pm_1Pgc75B7WZ01zgkWlHVgdEGJ/detach \
  -H "Authorization: Bearer $KNOX_SECRET_KEY"
Response
{
  "allow_redisplay": "unspecified",
  "billing_details": {
    "address": {
      "city": "San Francisco",
      "country": "US",
      "line1": "1234 Fake Street",
      "line2": null,
      "postal_code": "94102",
      "state": "CA"
    },
    "email": "[email protected]",
    "name": null,
    "phone": "+15555555555",
    "tax_id": null
  },
  "card": {
    "brand": "visa",
    "checks": {
      "address_line1_check": null,
      "address_postal_code_check": null,
      "cvc_check": "pass"
    },
    "country": "US",
    "display_brand": "visa",
    "exp_month": 8,
    "exp_year": 2030,
    "fingerprint": "AOB934RVNwzk6xtn",
    "funding": "credit",
    "generated_from": {
      "charge": null,
      "payment_method_details": {
        "type": "type"
      },
      "setup_attempt": null
    },
    "last4": "4242",
    "networks": {
      "available": [
        "visa"
      ],
      "preferred": null
    },
    "three_d_secure_usage": {
      "supported": true
    },
    "wallet": {
      "dynamic_last4": null,
      "type": "link"
    },
    "regulated_status": null
  },
  "created": 1234567890,
  "customer": null,
  "id": "pm_1Pgc75B7WZ01zgkWlHVgdEGJ",
  "livemode": false,
  "metadata": {
    "order_id": "123456789"
  },
  "object": "payment_method",
  "type": "card",
  "customer_account": null
}

Operations and schemas come from the pinned Stripe OpenAPI specification (MIT); response examples from its fixtures. Nested object definitions and enums are in the complete specification.