See also the Braintree::CreditCard response object.

important

Typically requires PCI SAQ D compliance

We recommend using payment_method functions to avoid any PCI concerns with raw credit card data being present on your server.

Parameters
:billing_address

A billing address associated with a specific customer ID. It can be further associated with a specific payment method. The maximum number of addresses per customer is 50.

:company String

Company name. 255 character maximum.

:country_code_alpha2 String

The ISO 3166-1 alpha-2 country code specified in an address. The gateway only accepts specific alpha-2 values.

:country_code_alpha3 String

The ISO 3166-1 alpha-3 country code specified in an address. The gateway only accepts specific alpha-3 values.

:country_code_numeric String

The ISO 3166-1 numeric country code specified in an address. The gateway only accepts specific numeric values.

:country_name String

The country name specified in an address. We only accept specific country names.

:extended_address String

The extended address information—such as apartment or suite number. 255 character maximum.

:first_name String

The first name. 255 character maximum.

:last_name String

The last name. 255 character maximum.

:locality String

The locality/city. 255 character maximum.

:postal_code String

The postal code. Postal code must be a string of 4-9 alphanumeric characters, optionally separated by a dash or a space. Spaces, hyphens, and all other special characters are ignored.

:region String

The state or province. 255 character maximum.

:street_address String

The billing street address. 255 character maximum. Required to perform card verification when AVS rules are configured to require street address.

:billing_address_id String

The two-letter value for an address associated with a specific customer ID. The maximum number of addresses per customer is 50.

:cardholder_name String

The cardholder name associated with the credit card. 175 character maximum.

:customer_id required, String

A string value representing an existing customer in your Vault that you want to add a credit card for.

:cvv String

A 3 or 4 digit card verification value assigned to credit cards. The CVV will never be stored in the gateway, but it can be provided with one-time requests to verify the card.

:expiration_date String

The expiration date, formatted MM/YY or MM/YYYY. May be used instead of expiration_month and expiration_year.

:expiration_month String

The expiration month of a credit card, formatted MM. May be used with expiration_year, and instead of expiration_date.

:expiration_year String

The two or four digit year associated with a credit card, formatted YYYY or YY. May be used with expiration_month, and instead of expiration_date.

:number String

The 12-19 digit value consisting of a bank identification number (BIN) and primary account number (PAN). Passing the number directly (rather than passing a nonce) should only be done in a PCI compliant environment. If in doubt, use payment_method_nonce with Braintree::PaymentMethod.create()

:options

Optional values that can be passed with a request.

:fail_on_duplicate_payment_method bool

If this option is passed and the payment method has already been added to the Vault, the request will fail.

:make_default bool

This option makes the specified payment method the default for the customer.

:verification_amount String

Specify a non-negative amount that you want to use to verify a card. If you do not pass this option, the gateway will automatically use a verification amount of $0 or $1, depending on the processor and/or card type.

:verification_merchant_account_id String

Specify the merchant account ID that you want to use to verify a card. See the merchant_account_id on Braintree::Transaction.sale() to learn more. The merchant account cannot be a marketplace sub-merchant account. See the Braintree Marketplace Guide to learn more.

:verify_card bool

This option prompts the gateway to verify the card's number and expiration date. It also verifies the AVS and CVV information if you've enabled AVS and CVV rules. If you want to verify all cards before they are stored in your Vault, you can turn on card verification for your entire account in the Control Panel.

In some cases, cardholders may see a temporary authorization on their account after their card has been verified. The authorization will fall off the cardholder's account within a few days and will never settle.

Only returns a Braintree::CreditCardVerification result if verification runs and is unsuccessful.

:payment_method_nonce String

One-time-use reference to card information provided by your customer.

:token String

An alphanumeric value that references a specific payment method stored in your Vault. Must be less than or equal to 36 characters. If using a custom integration, you can specify what you want the token to be. If not specified, the gateway will generate one that can be accessed on the result. If using our Drop-in UI, you cannot specify your own token. Length and format of gateway-generated tokens and IDs may change at any time.

Payment method nonces vs. raw card data

While it is possible to pass both raw card data and a payment method nonce in the same call, we recommend passing only a payment method nonce.

Passing both will result in a payment method that has a mix of their attributes, with precedence given to the fields individually, then to the attributes of the payment method nonce. For example, if you pass both a card number and a payment method nonce, the payment method will have the number you passed explicitly, but the rest of the attributes will be obtained through the nonce.

Still have questions?

If you can’t find an answer, contact our Support team.