Customizing iframe form elements
Background |
---|
Before starting this tutorial, make sure you understand the following topics from the Quick start section:
|
By default, each ecommerce and retail iframe displays a standard set of fields for the form.
You can show or hide all these elements:
Element | Parameters for uiOptions | Default value | Description |
---|---|---|---|
Submit button | displaySubmitButton | false | Set to true to display a submit button within the iframe. If you leave it as false , you must provide a submission button elsewhere on the web page. |
Billing fields | hideBilling.hideAddressOne hideBilling.hideAddressTwo hideBilling.hideCity hideBilling.hideState hideBilling.hidePostal hideBilling.hideCountry hideBilling.hidePhone | false (for all) | Set to true for one or more of these parameters to hide the indicated field from the form.Optionally, set hideBilling to true to hide all the billing fields. |
Security code field | hideCvc | false | Set to true to hide the security code field. |
Country selection menu | limitCountriesTo | All | Leave this parameter out of the request in order to show all available countries, based on the merchant ID (MID). If you add this parameter and provide an array of country codes, only the specified countries display in the selection list. For example, specify ["CN","DE","NL","ES","US"] to display "China", "Germany", "Netherlands", Spain", and "United States" in the list. |
Form validation for security code | uiOptions.requireCvc | true | Set to false to allow form submission without requiring a security code. |
You can customize the elements that display by following these steps:
-
Send a
POST
request to the Create one-time-use token endpoint.-
Include the
uiOptions
object and one or more of the parameters from the table above in the body of the request.For example, to display a submit button, limit the countries to the United States and Canada, and to hide the phone and second address line fields, the request looks similar to the following:
curl -X POST https://api.nexiopaysandbox.com/pay/v3/token \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Basic [Base64_encoded_login]' \ -d '{ "uiOptions": { "displaySubmitButton": true, "limitCountriesTo": ["CA","US"], "hideBilling": { "hideAddressTwo": true, "hidePhone": true } } }'
The response includes a
token
parameter. Encoded within this value is the settings for the form. Save thistoken
for use in the next step.{ "expiration": "2022-09-18T15:43:05.664Z", "fraudUrl": "https://api.nexiopaysandbox.com/pay/v3/fingerprint?token=830d36f6-a5e3-4455-9600-3a55b63e2fc2", "token": "830d36f6-a5e3-4455-9600-3a55b63e2fc2" }
-
-
Request the iframe to display on the page using the
token
from the response in step 1.You may display a customized form for the iframe for any of the following types of pages:
- Save payment information page for card - using Save card token with iframe
- Save payment information page for echeck - using Save echeck token with iframe
- Checkout page for card - using Run card transaction with iframe
- Checkout page for echeck - using Run echeck transaction with iframe
For example, the following request uses the
token
to return the HTML for an iframe for a checkout page for a card, with the settings as specified in step 1.curl -X GET https://api.nexiopaysandbox.com/pay/v3?token=830d36f6-a5e3-4455-9600-3a55b63e2fc2'
Updated 6 months ago