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

NameDescription
tokenToken of existing payment method in the Spreedly environment
optionsMap 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

NameDescription
optionsMap of display option

Display options include:

NameDescription
amountThe amount to display to the user, including currency. E.g., $9.83.
company_nameThe name of the merchant
sidebar_top_descriptionText to display under the company name
sidebar_bottom_descriptionText to display under the amount
close_labelLabel to use to dismiss the Express view. Defaults to “Cancel”.
name_labelThe input label to use for the user’s name field
number_labelThe input label to use for the credit card number field
cvv_labelThe input label to use for the credit card verification field
expiration_labelThe input label to use for the credit card expiration field
submit_labelThe label for the submit button. Default is “Pay Now”.
full_nameAutofill 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

NameDescription
parametersMap 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()