Members
(static) VERSION :string
The current version of the SDK, i.e. 3.11.1
.
- Source:
Methods
(static) create(options, callbackopt) → {void}
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | Creation options: Properties
|
|||||||||||||
callback |
callback |
<optional> |
The second argument, |
- Source:
Examples
braintree.hostedFields.create({
client: clientInstance,
styles: {
'input': {
'font-size': '16pt',
'color': '#3A3A3A'
},
'.number': {
'font-family': 'monospace'
},
'.valid': {
'color': 'green'
}
},
fields: {
number: {
selector: '#card-number'
},
cvv: {
selector: '#cvv',
placeholder: '•••'
},
expirationDate: {
selector: '#expiration-date',
type: 'month'
}
}
}, callback);
Right to Left Language Support
braintree.hostedFields.create({
client: clientInstance,
styles: {
'input': {
// other styles
direction: 'rtl'
},
},
fields: {
number: {
selector: '#card-number',
// Credit card formatting is not currently supported
// with RTL languages, so we need to turn it off for the number input
formatInput: false
},
cvv: {
selector: '#cvv',
placeholder: '•••'
},
expirationDate: {
selector: '#expiration-date',
type: 'month'
}
}
}, callback);
Type Definitions
field :object
Fields used in fields options
Properties:
Name | Type | Attributes | Default | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
selector |
string | A CSS selector to find the container where the hosted field will be inserted. |
||||||||||
placeholder |
string |
<optional> |
Will be used as the |
|||||||||
type |
string |
<optional> |
Will be used as the |
|||||||||
formatInput |
boolean |
<optional> |
true | Enable or disable automatic formatting on this field. |
||||||||
select |
object | boolean |
<optional> |
If truthy, this field becomes a Properties
|
- Source:
fieldOptions :object
An object that has field objects for each field. Used in create.
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
number |
field |
<optional> |
A field for card number. |
expirationDate |
field |
<optional> |
A field for expiration date in |
expirationMonth |
field |
<optional> |
A field for expiration month in |
expirationYear |
field |
<optional> |
A field for expiration year in |
cvv |
field |
<optional> |
A field for 3 or 4 digit CVV or CID. |
postalCode |
field |
<optional> |
A field for postal or region code. |
- Source:
styleOptions :object
An object that represents CSS that will be applied in each hosted field. This object looks similar to CSS. Typically, these styles involve fonts (such as font-family
or color
).
These are the CSS properties that Hosted Fields supports. Any other CSS should be specified on your page and outside of any Braintree configuration. Trying to set unsupported properties will fail and put a warning in the console.
Supported CSS properties are:
color
direction
font-family
font-size-adjust
font-size
font-stretch
font-style
font-variant-alternates
font-variant-caps
font-variant-east-asian
font-variant-ligatures
font-variant-numeric
font-variant
font-weight
font
letter-spacing
line-height
opacity
outline
text-shadow
transition
-moz-osx-font-smoothing
-moz-tap-highlight-color
-moz-transition
-webkit-font-smoothing
-webkit-tap-highlight-color
-webkit-transition
- Source: