Transaction

Transaction: Sale

See also the Transaction response object.

To create a transaction, you must include an amount and either a paymentMethodNonce, a paymentMethodToken, or a customerId. Passing a customerId is equivalent to passing the paymentMethodToken of the customer's default payment method.

Braintree offers products that manage risk and fraud related to each transaction. These products can only be leveraged if there is adequate data to support the capabilities. The required data can be easily added during the Braintree SDK or Graph QL. integration, and must be done prior using risk products. For additional guidance go to Premium Fraud Management Tools.

The following example creates a transaction using a paymentMethodNonce from a client and instructs that it should be submitted for settlement immediately using options.submitForSettlement. You can see more examples, including using a vaulted payment method, below the parameter reference.

  1. PHP
$result = $gateway->transaction()->sale([
  'amount' => '10.00',
  'paymentMethodNonce' => $nonceFromTheClient,
  'deviceData' => $deviceDataFromTheClient,
  'options' => [
    'submitForSettlement' => True
  ]
]);

if ($result->success) {
  // See $result->transaction for details
} else {
  // Handle errors
}
Parameters
'amount'String

The billing amount of the request. This value must be greater than 0, and must match the currency format of the merchant account. Can only contain numbers and one decimal point (e.g. x.xx). Can't be greater than the maximum allowed by the processor. Contact us for your specific limit.

Billing address information associated with a specific customer ID.

AVS rules are not applied when creating a transaction from a Vault record using a payment method token. We still submit the street address and postal code to the processor to run AVS checks. The transaction response includes processor AVS response codes.

'company'string
Company name. 255 character maximum.

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

PayPal transactions must use the alpha-2 format. See PayPal's country code documentation for details.

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

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

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

The extended address information—such as apartment or suite number. 255 character maximum.
The first name. The first name value must be less than or equal to 255 characters.
The last name. The last name value must be less than or equal to 255 characters.
The locality/city. 255 character maximum.
The phone number that belongs to the billing address. Phone number must be 10-14 characters and can only contain numbers, hyphens and parentheses.
The postal code. Postal code must be a string of 4-9 alphanumeric characters, optionally separated by a dash or a space. Spaces and hyphens are ignored.
'region'string
The state or province. For PayPal addresses, the region must meet PayPal's state restrictions; for all other payment methods, it must be less than or equal to 255 characters.
The billing street address. 255 character maximum. Required when AVS rules are configured to require street address.
The two-letter value for an address associated with a specific customer ID. The maximum number of addresses per customer is 50.
'channel'string

For partners and shopping carts only

If you are a shopping cart provider or other Braintree partner, pass a string identifier for your service. For PayPal transactions, this maps to paypal.bn_code.

Typically requires PCI SAQ D compliance

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

A credit or debit payment method.

The name associated with the credit card. Must be less than or equal to 175 characters.
'cvv'string

A 3 or 4 digit card verification value assigned to credit cards.

To meet PCI guidelines, CVV will never be stored in the gateway. CVV is not required when creating a transaction from Vault tokens; CVV rules will be applied to transactions if and only if the CVV is supplied with the tokens.

CVV checking can also be done when you create or update the Vault record by using card verification.

The expiration date, formatted MM/YY or MM/YYYY. May be used instead of expiration_month and expiration_year.
The expiration month of a credit card, formatted MM. May be used with expiration_year, and instead of expiration_date.
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.
A set of fields required to process a third party card-on-file network token transaction.
The token cryptogram.
Ecommerce indicator (ECI) value.
The token requestor ID.
'number'string
The 12-19 digit value consisting of a bank identification number (BIN) and primary account number (PAN).
A set of fields required to process a transaction that was initiated through manual key entry on a payment reader.
The encrypted payload containing credit card data.
The key serial number used to identify details required for data decryption.
'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 with a customer ID to vault payment methods, you can't specify your own token. Length and format of gateway-generated tokens and IDs may change at any time.

A collection of custom field/value pairs. Fields and values must be formatted as strings or integers. Maximum 255 characters. You must set up each custom field in the Control Panel prior to passing it with a request. Querying this value returns a collection of custom field values stored on the transaction object.

When storing a new customer in the Vault, you can use this object to specify the customer's details. Only use this parameter when creating a new customer with a new payment method. See the customer object for further details.

'company'string
Company name. 255 character maximum.
'email'string
Email address composed of ASCII characters. 255 character maximum.
'fax'string
Fax number. 255 character maximum.
The first name. The first name value must be less than or equal to 255 characters.
'id'string
A string value that will represent this specific customer in your Vault. 36 character maximum; must be unique within your Vault; valid characters are letters, numbers, -, and _; the words "all" and "new" currently can't be used. If not specified on creation, the gateway will generate an alphanumeric ID that can be accessed on the result. The generated IDs will never start with a leading 0 and are case insensitive.
The last name. The last name value must be less than or equal to 255 characters.
'phone'string
Phone number. Phone must be 10-14 characters and can only contain numbers, hyphens and parentheses.
'website'string
Website URL. Must be less than or equal to 255 characters. Website must be well-formed. The URL scheme is optional.
A string value representing an existing customer in your Vault that you want to charge.

Dynamic descriptors are not enabled on all accounts by default. If you receive a validation error of 92203 or if your dynamic descriptors are not displaying as expected, please contact us.

Dynamic descriptors are sent on a per-transaction basis and define what will appear on your customers' credit card statements for a specific purchase. The clearer the description of your product, the less likely customers will issue chargebacks due to confusion or non-recognition.



See the dynamic descriptor example for additional information.

'name'string

The value in the business name field of a customer's statement. The specific length/character requirements for this value depend on your processor. Contact us for assistance.

'phone'string
The value in the phone number field of a customer's statement. Phone must be 10-14 characters and can only contain numbers, hyphens and parentheses.
'url'string
The value in the URL/web address field of a customer's statement. The URL must be 13 characters or shorter.

Customer device information. Required in the following cases:

This value will contain a Device Session ID as the unique identifier for a customer device. For Fraud Protection, PayPal, and Venmo transactions, this value will also include a PayPal Correlation ID. Provide the full string received from the Braintree client SDK.

Deprecated.

We recommend including the device session ID within deviceData. This functionality still exists in the gateway but is no longer documented. It will remove this param/attr when the corresponding gateway code is removed.

A Level 3 field that specifies the discount amount that was included in the total transaction amount. It can't be negative, and it does not add to the total transaction amount. This PayPal Braintree line-item field is not used by PayPal.

The ID of a previously generated exchange rate quote to be used for presentment to settlement currency conversion. An ID obtained earlier can be used to get a new quote for the same currency pair and different base amount as long as the ID has not expired.
Options used to indicate when a payment method is externally vaulted. These fields should be provided when storing a customer's payment methods in an external vault (e.g. third-party vault, not tokenizing through Braintree).
Network transaction identifier issued by the card brand networks during a previous transaction. Card brand networks provide network transaction identifiers to improve authorization approval rates for stored credential transactions.
'status'string

The option indicates the vaulted status of the externally vaulted payment method. Accepted values:

  • vaulted = Indicates the payment method is already stored on behalf of the customer.
  • will_vault = Indicates the payment method is intended to be vaulted upon successful processing of the transaction.
This functionality still exists in the gateway but is no longer documented. Will remove this param/attr when the corresponding gateway code is removed. Old description – A unique, numeric identifier for a Kount account. Required only when you have a direct relationship with Kount, including a fraud_merchant_id with your requests ensures that we will route them to your specific Kount account for evaluation.

The line items for this transaction. It can include up to 249 line items. If your merchant account has been configured for Level 3 processing this field will be passed to the processor on your behalf.

Code used to classify items purchased and track the total amount spent across various categories of products and services. Different corporate purchasing organizations may use different standards, but the United Nations Standard Products and Services Code (UNSPSC) is frequently used. Maximum 12 characters. This PayPal Braintree line-item field is not used by PayPal.
Item description. Maximum 127 characters.
Discount amount for the line item. Can include up to 2 decimal places. This value can't be negative. This PayPal Braintree line-item field is not used by PayPal.
'kind'string

Indicates whether the line item is a debit (sale) or credit (refund) to the customer. Accepted values:

  • "debit"
  • "credit"
'name'string
Item name. Maximum 35 characters, or 127 characters for PayPal transactions.
Product or UPC code for the item. Maximum 12 characters, or 127 characters for PayPal transactions.
Number of units of the item purchased. Can include up to 4 decimal places. This value can't be negative or zero.
Quantity x unit amount. Can include up to 2 decimal places.
Per-unit price of the item. Maximum 4 decimal places, or 2 decimal places for PayPal transactions. This value can't be negative or zero. Zero is allowed for PayPal transactions.
The unit of measure or the unit of measure code. Maximum 12 characters. This PayPal Braintree line-item field is not used by PayPal.
Per-unit tax price of the item. Can include up to 2 decimal places. This value can't be negative.
'url'string
The URL to product information.

The merchant account ID used to create a transaction. Currency is also determined by merchant account ID. If no merchant account ID is specified, we will use your default merchant account.

Optional values that can be passed with a request.
The option that determines whether the billing address information provided in the request should be added to the payment method specified. This option works only for new payment methods.
Card-specific options

Specifies which account type the transaction should be processed with. This will need to be set up even if the account_type parameter was passed in the corresponding 3D Secure call as it will not carry over.

Accepted account types are:

  • credit (default)
  • debit
note

Some cards can be processed using either a credit or debit account and cardholders have the option to choose which account to process a transaction.

For Braintree Marketplace merchants only. This value specifies whether a transaction is held in escrow. See Escrow for more detail.

PayPal-specific options.
Variable passed directly to PayPal via the API for your own tracking purposes. Customers do not see this value, but you can see it in reports from your PayPal console. It also appears in the Braintree Control Panel on the Transaction Detail page of the associated PayPal transaction, and in the CSV file of downloaded transaction searches. Unlike Braintree custom fields, this field does not need to be configured in the Braintree Control Panel.
Description of the transaction that is displayed to customers in PayPal email receipts. Max 127 characters.
If provided, these values will be used by the processor. The values provided will take precedence over any similar fields, and will only be used for processing. These values will not update any similar fields and will not be returned in responses.
Email address composed of ASCII characters.
The first name. The first name value must be less than or equal to 255 characters.
The last name. The last name value must be less than or equal to 255 characters.
The Social Security number analogue for the corresponding country.

Prevents the transaction from being evaluated as part of Premium Fraud Management Tools checks. Use with caution – once you've skipped checks for a transaction, it is not possible to run them retroactively.

'skipAvs'boolean

Skip AVS checks for the transaction. Will result in a processor response code of B for avsPostalCodeResponseCode and avsStreetAddressResponseCode, and nil for avsErrorResponseCode. Use with caution – once you've skipped checks for a transaction, it is not possible to run them retroactively.

'skipCvv'boolean

Skip CVV checks for the transaction. Will result in a processor response code of B for cvvResponseCode. Use with caution – once you've skipped checks for a transaction, it is not possible to run them retroactively.

The option that determines whether the payment method should be stored in the Vault, regardless of the transaction's success.
The option that determines whether the payment method associated with the successful transaction should be stored in the Vault.

The option that determines whether the shipping address information provided with the transaction should be associated with the customer ID specified. When passed, the payment method will always be stored in the Vault.

If there is already a shipping address associated with the customer, this parameter will not replace the existing information; an additional address will be stored instead. You can associate up to 50 addresses with a single customer ID.

The option that determines whether an authorized transaction is submitted for settlement.
Options for 3D Secure verification. Can only be used when the payment method nonce parameter is present.

Specify whether to require 3D Secure verification to succeed before creating a transaction. Defaults to true for transactions sent through 3D Secure verification but to false for transactions not sent through 3D Secure verification. For more information, see 3D Secure advanced server-side options.

Options for a Pay with Venmo transaction.
Specify which Venmo business profile to use for a transaction.
'orderId'string
Use this field to pass additional information about the transaction. On PayPal transactions, this field maps to the PayPal invoice number. PayPal invoice numbers must be unique in your PayPal business account. Maximum 255 characters or 127 for PayPal transactions.

One-time-use reference to payment information provided by your customer, such as a credit card or PayPal account. Can be passed instead of a paymentMethodToken parameter.

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 with a customer ID to vault payment methods, you can't specify your own token. Length and format of gateway-generated tokens and IDs may change at any time.

A Level 2 field that can be used to pass a purchase order identification value of up to 12 ASCII characters for AIB and 17 ASCII characters for all other processors.

Deprecated.

We recommend using transactionSource with a value of recurring.

A value indicating whether the transaction is being passed with a recurring ecommerce indicator (ECI) flag. If passed, the amount submitted for settlement must exactly match the authorized amount.

AVS and CVV rules do not apply to recurring payments.

Customer device information, which is sent directly to supported processors for fraud analysis. These fields are automatically populated if using Premium Fraud Management Tools. Currently only available when processing American Express via Amex Direct. Contact us with any questions.

The User-Agent header provided by the customer's browser, which gives information about the browser. Maximum 255 characters.
The customer's IP address.

Specifies the Secure Customer Authentication exemption that this transaction will be claiming.

Accepted values:

  • low_value
  • secure_corporate
  • trusted_beneficiary

The portion of a sub-merchant's transaction revenue that is routed to the master merchant account. If set, this value must be greater than or equal to 0, must match the appropriate currency format, and can't exceed the transaction amount.

Available to Braintree Marketplace merchants. See charging a service fee and holding funds in escrow on Braintree Marketplace transactions.

For Shared Vault only

The ID of an address belonging to the OAuth application owner. If used in conjunction with a sharedCustomerId, must belong to the specified customer.

For Shared Vault only

The ID of a customer belonging to the OAuth application owner. If no sharedPaymentMethodToken is specified, the customer's default payment method will be used.

For Shared Vault only

A payment method nonce belonging to the OAuth application owner. These payment method nonces can be credit cards or channel-initiated PayPal Billing Agreements that have been executed. Mutually exclusive with sharedPaymentMethodToken.

For Shared Vault only

The token of a payment method belonging to the OAuth application owner. Mutually exclusive with sharedPaymentMethodNonce. If no sharedCustomerId is explicitly specified, the customer that owns the payment method is implicitly specified. If used in conjunction with a sharedCustomerId, must belong to the specified customer.

For Shared Vault only

The ID of an address belonging to the OAuth application owner. If used in conjunction with a sharedCustomerId, must belong to the specified customer.

Shipping address information associated with a specific customer ID.
'company'string
Company name. 255 character maximum.

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

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

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

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

The extended address information—such as apartment or suite number. 255 character maximum.
The first name. The first name value must be less than or equal to 255 characters. Required if passing a PayPal shipping address.
The last name. The last name value must be less than or equal to 255 characters. Required if passing a PayPal shipping address.
The locality/city. 255 character maximum. Required if passing a PayPal shipping address.
The phone number that belongs to the shipping address. Phone number must be 10-14 characters and can only contain numbers, hyphens and parentheses.
The postal code. Postal code must be a string of 4-9 alphanumeric characters, optionally separated by a dash or a space. Spaces and hyphens are ignored. Required if passing a PayPal shipping address.
'region'string
The state or province. For PayPal addresses, the region must meet PayPal's state restrictions; for all other payment methods, it must be less than or equal to 255 characters. Required if passing a PayPal shipping address.

The shipping method used for the shipping address. Possible values:

  • sameDay
  • expedited
  • priority
  • ground
  • electronicDelivery
  • shipToStore
  • pickupInStore
The street address. 255 character maximum. Required if passing a PayPal shipping address.
A shipping address associated with a specific customer ID. The maximum number of addresses per customer is 50.

A Level 3 field that specifies the shipping cost on the entire transaction. It can't be negative, and it does not add to the total transaction amount.

A Level 3 field that specifies the postal code of the shipping location.

The data field that specifies the surcharge amount that was included in the total transaction amount. It can't be negative, and it does not add to the total transaction amount. Your merchant account must be registered for surcharging.

A Level 2 field that specifies the amount of tax that was included in the total transaction amount. The value can't be negative, and in most cases, it must be greater than zero in order to qualify for lower interchange rates. It does not add to the total transaction amount.

A Level 2 field that indicates whether or not the transaction should be considered eligible for tax exemption. This does not affect the total transaction amount.

ID of the 3D Secure authentication performed for this transaction. Do not provide this field if you are using a nonce for this transaction that is 3D Secure enriched.

Results of a merchant-performed 3D Secure authentication. You will only need to use these fields if you've performed your own integration with a 3D Secure MPI provider (e.g. Cardinal Centinel). Otherwise, Braintree's SDKs handle this for you in our standard 3D Secure integration.

'cavv'string

Cardholder authentication verification value or CAVV. The main encrypted message issuers and card networks use to verify authentication has occurred. Mastercard uses an AVV message and American Express uses an AEVV message, each of which should also be passed in the cavv parameter.

Transaction identifier resulting from 3D Secure 2 authentication. This field must be supplied for Mastercard Identity Check.

'eciFlag'string

The value of the electronic commerce indicator (ECI) flag, which indicates the outcome of the 3DS authentication.

Accepted values for Mastercard:

  • 00 = Failed or not attempted
  • 01 = Attempted
  • 02 = Success
  • 04 = Data-Only (Applies to limited processors)

Accepted values for all other card brands:

  • 07 = Failed or not attempted
  • 06 = Attempted
  • 05 = Success

The version of 3D Secure authentication used for the transaction. Required on Visa and Mastercard authentications. Must be composed of digits separated by periods (e.g. 1.0.2).

'xid'string

Transaction identifier resulting from 3D Secure authentication. Uniquely identifies the transaction and sometimes required in the authorization message. Must be base64-encoded. This field will no longer be used in 3D Secure 2 authentications.

Specifies the source of the transaction. The value passed depends on whether the transaction is initiated by the merchant or the customer. If the transaction is an ecommerce transaction initiated by the customer, no value is passed.

Accepted values for merchant-initiated transactions:

  • recurring = Transactions for subsequent recurring payments (e.g. subscriptions with a fixed amount on a predefined schedule).
  • unscheduled = Transactions for unscheduled payments that are not recurring on a predefined schedule or amount (e.g. balance top-up). Formerly merchant.
  • installment = Transactions for subsequent installment payments. (e.g. when the customer makes a single large purchase and wants to make payments over time).

Accepted values for customer-initiated transactions:

  • recurring_first = Transactions that represent the first in a series of recurring payments or subscription.
  • moto = Transactions that are initiated by the customer via the merchant by mail or telephone.
  • installment_first = Transactions that represent the first in a series of installment payments.
  • estimated = Transactions that support subsequent incremental authorization.

Note: installment and installment_first may only be available in certain regions. If installment transactions are not supported in your region, the transaction will automatically be categorized as recurring.

Learn more about the Visa Stored Credential Framework in our blog.

Examplesanchor

Full exampleanchor

Here is an example of passing in everything a typical merchant might use.

Some parameters are mutually exclusive, so we'll show those in separate examples. If there is anything you want to store with the transaction details that we don't have a field for, you can always use custom fields.

Collect device data from the client and include the deviceDataFromTheClient in the transaction.

  1. PHP
$result = $gateway->transaction()->sale([
  'amount' => '100.00',
  'orderId' => 'order id',
  'merchantAccountId' => 'a_merchant_account_id',
  'paymentMethodNonce' => $nonceFromTheClient,
  'deviceData' => $deviceDataFromTheClient,
  'customer' => [
    'firstName' => 'Drew',
    'lastName' => 'Smith',
    'company' => 'Braintree',
    'phone' => '312-555-1234',
    'fax' => '312-555-1235',
    'website' => 'http://www.example.com',
    'email' => 'drew@example.com'
  ],
  'billing' => [
    'firstName' => 'Paul',
    'lastName' => 'Smith',
    'company' => 'Braintree',
    'streetAddress' => '1 E Main St',
    'extendedAddress' => 'Suite 403',
    'locality' => 'Chicago',
    'region' => 'IL',
    'postalCode' => '60622',
    'countryCodeAlpha2' => 'US'
  ],
  'shipping' => [
    'firstName' => 'Jen',
    'lastName' => 'Smith',
    'company' => 'Braintree',
    'streetAddress' => '1 E 1st St',
    'extendedAddress' => 'Suite 403',
    'locality' => 'Bartlett',
    'region' => 'IL',
    'postalCode' => '60103',
    'countryCodeAlpha2' => 'US'
  ],
  'options' => [
    'submitForSettlement' => true
  ]
]);

If all the parameters are valid, a transaction will be created with a status of submitted_for_settlement and success? will return true.

  1. PHP
$result->success
# true

$result->transaction->status
# e.g. 'submitted_for_settlement'

$result->transaction->type
# e.g. 'credit'

Storing in Vaultanchor

When creating a transaction, you can also store the payment method in your Vault.

Existing customer with new payment methodanchor

To associate this transaction's payment method with an existing customer, pass a customerId along with options.storeInVault or options.storeInVaultOnSuccess as true.

  1. PHP
$result = $gateway->transaction()->sale([
  'amount' => '10.00',
  'paymentMethodNonce' => nonceFromTheClient,
  'customerId' => 'the_customer_id',
  'options' => [
    'storeInVaultOnSuccess' => true,
  ]
]);

New customer with new payment methodanchor

To store a payment method for a new customer, set options.storeInVault or options.storeInVaultOnSuccess to true on your transaction. You can optionally specify customer parameters for your new customer, as well:

  1. PHP
$result = $gateway->transaction()->sale([
  'amount' => '10.00',
  'paymentMethodNonce' => nonceFromTheClient,
  'customer' => [
    'id' => 'a_customer_id'
  ],
  'options' => [
    'storeInVaultOnSuccess' => true,
  ]
]);
note

The customer parameter should only be used when creating a new customer with a new payment method, and storeInVaultOnSuccess only vaults the payment method if the transaction is successful.

Using a vaulted payment methodanchor

You can create a transaction using a payment method stored in the Vault by passing a paymentMethodToken:

  1. PHP
$result = $gateway->transaction()->sale(
  [
    'paymentMethodToken' => 'the_payment_method_token',
    'amount' => '100.00'
  ]
);

Or use customerId, which will use the customer's default payment method:

  1. PHP
$result = $gateway->transaction()->sale(
  [
    'customerId' => 'the_customer_id',
    'amount' => '100.00'
  ]
);

Using a CVV-only nonceanchor

To transact with a CVV-only nonce, use both a nonce representing the CVV and a paymentMethodToken representing the vaulted payment method.

To collect a CVV-only nonce, use the client SDKs to tokenize only the CVV property. See an example in our Hosted Fields FAQ.

  1. PHP
$result = $gateway->transaction()->sale(
  [
    'paymentMethodToken' => 'the_payment_method_token',
    'paymentMethodNonce' => cvvOnlyNonceFromClient,
    'amount' => '100.00'
  ]
);

Specify merchant account IDanchor

To specify which merchant account to use, pass the merchantAccountId when creating the transaction.

  1. PHP
$result = $gateway->transaction()->sale([
  'amount' => '100.00',
  'merchantAccountId' => 'gbp_merchant_account',
  'paymentMethodNonce' => nonceFromTheClient
]);

If you don't specify the merchant account to use to process a transaction, Braintree will process it using your default merchant account.

Contact us if you would like to change which merchant account is default.

Using stored addressesanchor

You can use addresses stored on a customer by passing the address's ID. This works for both the shipping address and billing address.

  1. PHP
$result = $gateway->transaction()->sale(
  [
    'customerId' => 'the_customer_id',
    'amount' => '100.00',
    'billingAddressId' => 'AA',
    'shippingAddressId' => 'AB'
  ]
);

Custom fieldsanchor

Whatever you configure as the API name for your custom fields will be used when setting them on the transaction. Here is an example of setting custom fields with API names of custom_field_one and custom_field_two.

  1. PHP
$result = $gateway->transaction()->sale([
    'amount' => '100.00',
    'paymentMethodNonce' => nonceFromTheClient,
    'customFields' => [
        'custom_field_one' => 'custom value',
        'custom_field_two' => 'another custom value'
    ]
]);

$result->transaction->customFields['custom_field_one']
# 'custom value'

$result->transaction->customFields['custom_field_two']
# 'another custom value'

Dynamic descriptorsanchor

Dynamic descriptors are typically composed of a name and phone number or URL. The name must include the business name, followed by a product name or identifier, separated by an asterisk (*). Depending on the type of transaction you're creating, the length/character limits may differ from those outlined above. For example, you can only specify up to 18 characters for dynamic descriptor names on Braintree Marketplace transactions. See below for details on Venmo, PayPal, and Braintree Marketplace dynamic descriptors.

Your processor may also restrict which descriptor values you can pass; certain processors allow you to pass URLs instead of phone numbers, while others accept only phone numbers or only names. If your processor supports URLs and you send both a phone number and URL, we will only pass the URL to the processor. Contact us for more information on your processor's specific requirements.

  1. PHP
$result = $gateway->transaction()->sale([
    'amount' => '10.00',
    'paymentMethodNonce' => nonceFromTheClient,
    'descriptor' => [
        'name' => 'company*my product',
        'phone' => '3125551212',
        'url' => 'company.com'
    ]
]);
$result->transaction->descriptor->name
# 'company*my product'

$result->transaction->descriptor->phone
# '3125551212'

Venmoanchor

Venmo only supports the dynamic descriptor name. Its format allows alpha-numeric characters and +-. (space included); any other characters will result in the dynamic descriptor name not being included in the full descriptor sent to the processor.

The full descriptor submitted to the processor is structured as follows:

An example of a full descriptor with a valid dynamic descriptor name is: VENMO *AStore O-1234, where AStore is the Business Name and O-1234 is the Dynamic Descriptor Name. If the dynamic descriptor name contains invalid characters, e.g. 0#1234, the entire dynamic descriptor name will be ignored.

note

The full descriptor is limited to 22 characters. If this limit is exceeded, the Business Name and Dynamic Descriptor Name portion will be truncated as needed. If you want to change the Business Name of the descriptor, you can edit your Venmo profile via the Venmo Processing page in the Control Panel. This will also update the name displayed to customers in the Venmo app during transaction processing.

PayPalanchor

The PayPal dynamic descriptor is limited to a total of 22 characters and includes the following elements:

  • The default prefix of PAYPAL *
  • Your PayPal hard descriptor*
  • The product portion of your name (learn more below)

*Depending on your PayPal account setup, the PayPal hard descriptor may not be included in the dynamic descriptor. You can update the hard descriptor value from your PayPal console.

The name must meet the following guidelines:

  • Must include your registered Doing Business As (DBA) name, followed by an asterisk and a product description
  • The DBA portion must be 3, 7 or 12 characters long - this portion will be dropped from your dynamic descriptor
note

If the three parts of your dynamic descriptor combined exceed the 22 character limit, the name portion will automatically be truncated as needed.

The payment information displayed to a customer in their PayPal account overview does not contain the dynamic descriptor. The information displayed there is data the merchant has configured with PayPal directly (e.g. business name, email address, business contact details).

Braintree Marketplaceanchor

The only dynamic descriptor value we will pass for Braintree Marketplace transactions is the name you specify. We will not send any dynamic phone or url values to the processor, but we will pass the phone from the hard descriptor on your master merchant account.

The dynamic descriptor name can only contain the ASCII characters a-z, A-Z, the numbers 0-9, and the characters .-+ and spaces (it can't contain special characters like Ă‘, ĂĽ, and Ă©). The maximum length is 18 characters; we will truncate any longer strings. The descriptor we pass to the processor will start with "BT *", followed by the name you specify.

  • If the specified name is 12 characters or fewer, the descriptor we pass to the processor will end with a randomly generated 6-character string (e.g. 123abc) which identifies the sub-merchant:
BT *MYDESCRIPTOR123abc
  • If the specified name is 13 characters or greater, the descriptor we pass to the processor will not end with a randomly generated 6-character string:
BT *MYDESCRIPTORISLONG
note

The sub-merchant can't access the 6-character string—we automatically append it to the descriptor name after you submit the transaction request. The string can't be changed, as it is required in order to identify each transaction we process for the sub-merchant.

Hold a Braintree Marketplace transaction in escrow on creationanchor

Upon creating a Braintree Marketplace transaction, you can specify that its funds should be held in escrow. These funds can then be released at your discretion. By default, funds are not held in escrow.

  1. PHP
$result = $gateway->transaction()->sale(
  [
    'amount' => '100.00',
    'merchantAccountId' => 'blue_ladders_store',
    'paymentMethodNonce' => nonceFromTheClient,
    'options' => [
      'submitForSettlement' => true,
      'holdInEscrow' => true,
    ],
    'serviceFeeAmount' => "10.00"
  ]
)