Open Context Protocol is live! 🚀 Read the launch post

postTokens

Create a CVC update token

Details

  • Method: POST
  • Path: /v1/tokens
  • Operation ID: PostTokens

Parameters

{}

Response Schema

{
  "description": "Tokenization is the process Stripe uses to collect sensitive card or bank\naccount details, or personally identifiable information (PII), directly from\nyour customers in a secure manner. A token representing this information is\nreturned to your server to use. Use our\n[recommended payments integrations](https://docs.stripe.com/payments) to perform this process\non the client-side. This guarantees that no sensitive card data touches your server,\nand allows your integration to operate in a PCI-compliant way.\n\nIf you can't use client-side tokenization, you can also create tokens using\nthe API with either your publishable or secret API key. If\nyour integration uses this method, you're responsible for any PCI compliance\nthat it might require, and you must keep your secret API key safe. Unlike with\nclient-side tokenization, your customer's information isn't sent directly to\nStripe, so we can't determine how it's handled or stored.\n\nYou can't store or use tokens more than once. To store card or bank account\ninformation for later use, create [Customer](https://docs.stripe.com/api#customers)\nobjects or [External accounts](/api#external_accounts).\n[Radar](https://docs.stripe.com/radar), our integrated solution for automatic fraud protection,\nperforms best with integrations that use client-side tokenization.",
  "properties": {
    "bank_account": {
      "description": "These bank accounts are payment methods on `Customer` objects.\n\nOn the other hand [External Accounts](/api#external_accounts) are transfer\ndestinations on `Account` objects for connected accounts.\nThey can be bank accounts or debit cards as well, and are documented in the links above.\n\nRelated guide: [Bank debits and transfers](/payments/bank-debits-transfers)",
      "properties": {
        "account": {
          "anyOf": [
            {
              "maxLength": 5000,
              "type": "string"
            },
            {
              "$ref": "#/components/schemas/account"
            }
          ],
          "description": "The account this bank account belongs to. Only applicable on Accounts (not customers or recipients) This property is only available when returned as an [External Account](/api/external_account_bank_accounts/object) where [controller.is_controller](/api/accounts/object#account_object-controller-is_controller) is `true`.",
          "nullable": true,
          "x-expansionResources": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/account"
              }
            ]
          }
        },
        "account_holder_name": {
          "description": "The name of the person or business that owns the bank account.",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "account_holder_type": {
          "description": "The type of entity that holds the account. This can be either `individual` or `company`.",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "account_type": {
          "description": "The bank account type. This can only be `checking` or `savings` in most countries. In Japan, this can only be `futsu` or `toza`.",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "available_payout_methods": {
          "description": "A set of available payout methods for this bank account. Only values from this set should be passed as the `method` when creating a payout.",
          "items": {
            "enum": [
              "instant",
              "standard"
            ],
            "type": "string"
          },
          "nullable": true,
          "type": "array"
        },
        "bank_name": {
          "description": "Name of the bank associated with the routing number (e.g., `WELLS FARGO`).",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "country": {
          "description": "Two-letter ISO code representing the country the bank account is located in.",
          "maxLength": 5000,
          "type": "string"
        },
        "currency": {
          "description": "Three-letter [ISO code for the currency](https://stripe.com/docs/payouts) paid out to the bank account.",
          "format": "currency",
          "type": "string"
        },
        "customer": {
          "anyOf": [
            {
              "maxLength": 5000,
              "type": "string"
            },
            {
              "$ref": "#/components/schemas/customer"
            },
            {
              "$ref": "#/components/schemas/deleted_customer"
            }
          ],
          "description": "The ID of the customer that the bank account is associated with.",
          "nullable": true,
          "x-expansionResources": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/customer"
              },
              {
                "$ref": "#/components/schemas/deleted_customer"
              }
            ]
          }
        },
        "default_for_currency": {
          "description": "Whether this bank account is the default external account for its currency.",
          "nullable": true,
          "type": "boolean"
        },
        "fingerprint": {
          "description": "Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "future_requirements": {
          "anyOf": [
            {
              "$ref": "#/components/schemas/external_account_requirements"
            }
          ],
          "description": "Information about the [upcoming new requirements for the bank account](https://docs.stripe.com/connect/custom-accounts/future-requirements), including what information needs to be collected, and by when.",
          "nullable": true
        },
        "id": {
          "description": "Unique identifier for the object.",
          "maxLength": 5000,
          "type": "string"
        },
        "last4": {
          "description": "The last four digits of the bank account number.",
          "maxLength": 5000,
          "type": "string"
        },
        "metadata": {
          "additionalProperties": {
            "maxLength": 500,
            "type": "string"
          },
          "description": "Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.",
          "nullable": true,
          "type": "object"
        },
        "object": {
          "description": "String representing the object's type. Objects of the same type share the same value.",
          "enum": [
            "bank_account"
          ],
          "type": "string"
        },
        "requirements": {
          "anyOf": [
            {
              "$ref": "#/components/schemas/external_account_requirements"
            }
          ],
          "description": "Information about the requirements for the bank account, including what information needs to be collected.",
          "nullable": true
        },
        "routing_number": {
          "description": "The routing transit number for the bank account.",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "status": {
          "description": "For bank accounts, possible values are `new`, `validated`, `verified`, `verification_failed`, `tokenized_account_number_deactivated` or `errored`. A bank account that hasn't had any activity or validation performed is `new`. If Stripe can determine that the bank account exists, its status will be `validated`. Note that there often isn’t enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be `verified`. If the verification failed for any reason, such as microdeposit failure, the status will be `verification_failed`. If the status is `tokenized_account_number_deactivated`, the account utilizes a tokenized account number which has been deactivated due to expiration or revocation. This account will need to be reverified to continue using it for money movement. If a payout sent to this bank account fails, we'll set the status to `errored` and will not continue to send [scheduled payouts](https://stripe.com/docs/payouts#payout-schedule) until the bank details are updated.\n\nFor external accounts, possible values are `new`, `errored`, `verification_failed`, and `tokenized_account_number_deactivated`. If a payout fails, the status is set to `errored` and scheduled payouts are stopped until account details are updated. In the US and India, if we can't [verify the owner of the bank account](https://support.stripe.com/questions/bank-account-ownership-verification), we'll set the status to `verification_failed`. Other validations aren't run against external accounts because they're only used for payouts. This means the other statuses don't apply.",
          "maxLength": 5000,
          "type": "string"
        }
      },
      "required": [
        "country",
        "currency",
        "id",
        "last4",
        "object",
        "status"
      ],
      "title": "BankAccount",
      "type": "object",
      "x-expandableFields": [
        "account",
        "customer",
        "future_requirements",
        "requirements"
      ],
      "x-resourceId": "bank_account"
    },
    "card": {
      "description": "You can store multiple cards on a customer in order to charge the customer\nlater. You can also store multiple debit cards on a recipient in order to\ntransfer to those cards later.\n\nRelated guide: [Card payments with Sources](https://docs.stripe.com/sources/cards)",
      "properties": {
        "account": {
          "anyOf": [
            {
              "maxLength": 5000,
              "type": "string"
            },
            {
              "$ref": "#/components/schemas/account"
            }
          ],
          "nullable": true,
          "x-expansionResources": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/account"
              }
            ]
          }
        },
        "address_city": {
          "description": "City/District/Suburb/Town/Village.",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "address_country": {
          "description": "Billing address country, if provided when creating card.",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "address_line1": {
          "description": "Address line 1 (Street address/PO Box/Company name).",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "address_line1_check": {
          "description": "If `address_line1` was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`.",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "address_line2": {
          "description": "Address line 2 (Apartment/Suite/Unit/Building).",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "address_state": {
          "description": "State/County/Province/Region.",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "address_zip": {
          "description": "ZIP or postal code.",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "address_zip_check": {
          "description": "If `address_zip` was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`.",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "allow_redisplay": {
          "description": "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”.",
          "enum": [
            "always",
            "limited",
            "unspecified"
          ],
          "nullable": true,
          "type": "string"
        },
        "available_payout_methods": {
          "description": "A set of available payout methods for this card. Only values from this set should be passed as the `method` when creating a payout.",
          "items": {
            "enum": [
              "instant",
              "standard"
            ],
            "type": "string"
          },
          "nullable": true,
          "type": "array"
        },
        "brand": {
          "description": "Card brand. Can be `American Express`, `Cartes Bancaires`, `Diners Club`, `Discover`, `Eftpos Australia`, `Girocard`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`.",
          "maxLength": 5000,
          "type": "string"
        },
        "country": {
          "description": "Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected.",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "currency": {
          "description": "Three-letter [ISO code for currency](https://www.iso.org/iso-4217-currency-codes.html) in lowercase. Must be a [supported currency](https://docs.stripe.com/currencies). Only applicable on accounts (not customers or recipients). The card can be used as a transfer destination for funds in this currency. This property is only available when returned as an [External Account](/api/external_account_cards/object) where [controller.is_controller](/api/accounts/object#account_object-controller-is_controller) is `true`.",
          "format": "currency",
          "nullable": true,
          "type": "string"
        },
        "customer": {
          "anyOf": [
            {
              "maxLength": 5000,
              "type": "string"
            },
            {
              "$ref": "#/components/schemas/customer"
            },
            {
              "$ref": "#/components/schemas/deleted_customer"
            }
          ],
          "description": "The customer that this card belongs to. This attribute will not be in the card object if the card belongs to an account or recipient instead.",
          "nullable": true,
          "x-expansionResources": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/customer"
              },
              {
                "$ref": "#/components/schemas/deleted_customer"
              }
            ]
          }
        },
        "cvc_check": {
          "description": "If a CVC was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`. A result of unchecked indicates that CVC was provided but hasn't been checked yet. Checks are typically performed when attaching a card to a Customer object, or when creating a charge. For more details, see [Check if a card is valid without a charge](https://support.stripe.com/questions/check-if-a-card-is-valid-without-a-charge).",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "default_for_currency": {
          "description": "Whether this card is the default external account for its currency. This property is only available for accounts where [controller.requirement_collection](/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts.",
          "nullable": true,
          "type": "boolean"
        },
        "dynamic_last4": {
          "description": "(For tokenized numbers only.) The last four digits of the device account number.",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "exp_month": {
          "description": "Two-digit number representing the card's expiration month.",
          "type": "integer"
        },
        "exp_year": {
          "description": "Four-digit number representing the card's expiration year.",
          "type": "integer"
        },
        "fingerprint": {
          "description": "Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number.\n\n*As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.*",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "funding": {
          "description": "Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`.",
          "maxLength": 5000,
          "type": "string"
        },
        "id": {
          "description": "Unique identifier for the object.",
          "maxLength": 5000,
          "type": "string"
        },
        "iin": {
          "description": "Issuer identification number of the card.",
          "maxLength": 5000,
          "type": "string"
        },
        "last4": {
          "description": "The last four digits of the card.",
          "maxLength": 5000,
          "type": "string"
        },
        "metadata": {
          "additionalProperties": {
            "maxLength": 500,
            "type": "string"
          },
          "description": "Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.",
          "nullable": true,
          "type": "object"
        },
        "name": {
          "description": "Cardholder name.",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "networks": {
          "description": "",
          "properties": {
            "preferred": {
              "description": "The preferred network for co-branded cards. Can be `cartes_bancaires`, `mastercard`, `visa` or `invalid_preference` if requested network is not valid for the card.",
              "maxLength": 5000,
              "nullable": true,
              "type": "string"
            }
          },
          "title": "token_card_networks",
          "type": "object",
          "x-expandableFields": []
        },
        "object": {
          "description": "String representing the object's type. Objects of the same type share the same value.",
          "enum": [
            "card"
          ],
          "type": "string"
        },
        "regulated_status": {
          "description": "Status of a card based on the card issuer.",
          "enum": [
            "regulated",
            "unregulated"
          ],
          "nullable": true,
          "type": "string"
        },
        "status": {
          "description": "For external accounts that are cards, possible values are `new` and `errored`. If a payout fails, the status is set to `errored` and [scheduled payouts](https://stripe.com/docs/payouts#payout-schedule) are stopped until account details are updated.",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        },
        "tokenization_method": {
          "description": "If the card number is tokenized, this is the method that was used. Can be `android_pay` (includes Google Pay), `apple_pay`, `masterpass`, `visa_checkout`, or null.",
          "maxLength": 5000,
          "nullable": true,
          "type": "string"
        }
      },
      "required": [
        "brand",
        "exp_month",
        "exp_year",
        "funding",
        "id",
        "last4",
        "object"
      ],
      "title": "Card",
      "type": "object",
      "x-expandableFields": [
        "account",
        "customer",
        "networks"
      ],
      "x-resourceId": "card"
    },
    "client_ip": {
      "description": "IP address of the client that generates the token.",
      "maxLength": 5000,
      "nullable": true,
      "type": "string"
    },
    "created": {
      "description": "Time at which the object was created. Measured in seconds since the Unix epoch.",
      "format": "unix-time",
      "type": "integer"
    },
    "id": {
      "description": "Unique identifier for the object.",
      "maxLength": 5000,
      "type": "string"
    },
    "livemode": {
      "description": "Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.",
      "type": "boolean"
    },
    "object": {
      "description": "String representing the object's type. Objects of the same type share the same value.",
      "enum": [
        "token"
      ],
      "type": "string"
    },
    "type": {
      "description": "Type of the token: `account`, `bank_account`, `card`, or `pii`.",
      "maxLength": 5000,
      "type": "string"
    },
    "used": {
      "description": "Determines if you have already used this token (you can only use tokens once).",
      "type": "boolean"
    }
  },
  "required": [
    "created",
    "id",
    "livemode",
    "object",
    "type",
    "used"
  ],
  "title": "Token",
  "type": "object",
  "x-expandableFields": [
    "bank_account",
    "card"
  ],
  "x-resourceId": "token"
}

Usage

from ocp_agent import OCPAgent

agent = OCPAgent()
await agent.register_api('stripe')

# Call this tool
result = await agent.call_tool('postTokens', {
    # Add required parameters here
})