Express configuration
API documentation for version 2 and version 3 of the Spreedly Express Javascript API.
Configuration
Express can be configured outside the initial init
invocation.
setRecache
Set Express to update the CVV on an already tokenized credit card instead of collecting new payment method information.
Note: A credit card must be retained in your environment in order to re-cache its CVV.
SpreedlyExpress.setRecache("56wyNnSmuA6CWYP7w0MiYCVIbW6" , {
"card_type": "visa",
"last_four_digits": "1234"
});
Signature
setRecache(token, options)
Arguments
Name | Description |
---|---|
token | Token of existing payment method in the Spreedly environment |
options | Map of recache options for existing payment method. Set card_type to support CVV validation and brand icons, and last_four_digits to show the last four digits in the number field. |
setDisplayOptions
Set display options for the Express window. Will override any options set on init
.
SpreedlyExpress.setDisplayOptions({
"amount": "$9.83",
"company_name": "Acme Widgets",
"sidebar_top_description": "Providing quality widgets since 2015",
"sidebar_bottom_description": "Your order total today",
"full_name": "First Last"
});
Signature
setDisplayOptions(options)
Arguments
Name | Description |
---|---|
options | Map of display option |
Display options
include:
Name | Description |
---|---|
amount | The amount to display to the user, including currency. E.g., $9.83 . |
company_name | The name of the merchant |
sidebar_top_description | Text to display under the company name |
sidebar_bottom_description | Text to display under the amount |
close_label | Label to use to dismiss the Express view. Defaults to “Cancel”. |
name_label | The input label to use for the user’s name field |
number_label | The input label to use for the credit card number field |
cvv_label | The input label to use for the credit card verification field |
expiration_label | The input label to use for the credit card expiration field |
submit_label | The label for the submit button. Default is “Pay Now”. |
full_name | Autofill the user’s name field by specifying a value here |
setPaymentMethodParams
Set additional payment method parameters for storage at Spreedly. Will override any parameters set on init
.
SpreedlyExpress.setPaymentMethodParams({
"email": "[email protected]"
});
Signature
setPaymentMethodParams(parameters)
Arguments
Name | Description |
---|---|
parameters | Map of parameters to add to the tokenized payment method |
Payment method parameters
include:
Name |
---|
email |
address1 |
address2 |
city |
state |
zip |
country |
phone_number |
company |
shipping_address1 |
shipping_address2 |
shipping_city |
shipping_state |
shipping_zip |
shipping_country |
shipping_phone_number |
toggleCvv
Toggles the visibility of the CVV field within the Express modal. When the CVV field is hidden, the CVV will not be required for tokenization.
SpreedlyExpress.toggleCvv();
Signature
toggleCvv()
Updated 6 days ago