Skip to main content
With a valid nonce, connect the payment form in three stages: load the library, build the payment payload and mount Flex.

1. Load CSS and JavaScript

To be used Alignet One Flex have to include the following code in the HTML from the page by environment:

CSS

Undetermined terms of the payment form. Include before closure <head>.

JS

Main library Alignet One Flex. Include after CSS at <head>.
Be sure to first include CSS and then JS to ensure that styles are applied correctly before the form starts.

2. Build the payment payload

The payload of Flex reuses the structure of API of Authorisation - ecommercewith an important difference: payment_method at the root object but as an empty object {}, because the client will choose the method within the form.
Think about this step as preparing the request for POST /charges for Flex. What you build here will be the basis of the operation that you will end up reading at responseCallback(response).

What’s preserved and what’s changing

Same base PayIn

Keep action, channel, merchant_code, merchant_operation_number, payment_method and payment_details.

Change Flex

In Flex, payment_method travels as {} empty because the actual method resolves in the front as the user select.

Payload structure

Expand each block to check which fields belong to each level of the object that you will send to Flex.

Retirement

Contains general information about the operation and links with payment_detailswhere she travels the details of the collection.
Gather the buyer’s amount, currency and operating subobjects, billing and sending.
Define the optional data of the client that makes the purchase useful for identification and risk context.
Contains required billing data that Flex necessary to process the operation.
It includes sending information as soon as your business flow needs to complement the operation.
For S /. 10.50 you should send 1050 and currency Value 604 for Soles.
In Flexand the root matter should be explicitly included payment_method: {} but the final method has not been selected by the user.

Full example

3. Mount the component

with payload built and nonce and established an instance of FlexPaymentForms and put the form on your DOM.
You need a nonce Current API Nonce and payload of Construction of payload before we continue.

Building parameters

Expand every block to check the fields you can send to the builder.

Mandatory information

Control the general visual performance of the component.
Define the means of payment that Flex will show the buyer.You have to send display_settings.methods with the payment methods you need to visualise at Flex.
Configure available languages within form.

Initiate and mount Flex

1

It creates an instance

Send the nonce, payload and the configuration that your integration needs.
2

Create the container

Add to HTML the element where Flex will generate their DOM.
3

Surrender form

Fits the instance and delivers the functions that will process the response, monitoring and errors.
If you define i18n.default_languageand uses one of the languages listed in i18n.languages.
#flex-container That’s just an example. Can use another selector as long as the item exists before running paymentForm.init(...).

3. Customize the checkout

Configure the visual experience and adapt Flex to your interface and mobile devices.