Initialize component
When creating a new instance of the component, a configuration object is required with the following properties: nonce (security value to exchange for a token), payload (transaction information to be processed), and settings (form configurations).
Parameters
Field | Required | Type | Description |
|---|---|---|---|
| Si | Alphanumeric | Encrypted code containing the Merchant key value. It must be generated on the backend using Alignet’s OAuth service. API Nonce |
| Si | JSON object | JSON containing the necessary details to initialize the form:
|
| No | Objeto | Form display settings |
| No | Array of strings | Payment methods to be displayed. Possible values:
If not sent, all payment methods enabled for the Merchant will be displayed by default. |
Payload object
The payload object maintains the same structure as API de Autorización - ecommerce excluding the payment_method object. payment_method:
Field | Description | Accepted Value | Type | Obligatorio |
|---|---|---|---|---|
| Action to execute | authorize |
| SI |
| Channel where the transaction will be executed | ecommerce |
| SI |
| Merchant identifier | Alphanumeric string |
| SI |
| Order number of the operation | Numeric string between 6 and 12 digits |
| SI |
| Object containing transaction information | NO |
| SI |
| Amount in cents for the operation. Decimal separation will be applied according to the currency. | Numeric string |
| SI |
| ISO-3 currency code for the operation (ISO link missing) | Numeric string |
| SI |
| Dictionary to send custom fields and values as key:value. Example: external_id:5468724 | NO |
| NO |
| Object containing information about the customer making the purchase | NO |
| NO |
| First name(s) | Alphanumeric string |
| NO |
| Last name(s) | Alphanumeric string |
| NO |
| Email address | Alphanumeric string |
| NO |
| Object containing phone information | NO |
| NO |
| Country code of the phone | Numeric string |
| NO |
| Phone number | Numeric string |
| NO |
| Object containing person/address information | NO |
| NO |
| Address line 1 | Alphanumeric string |
| NO |
| Address line 2 | Alphanumeric string |
| NO |
| City | Alphanumeric string |
| NO |
| State | Alphanumeric string |
| NO |
| Country | Alphanumeric string |
| NO |
| Object containing billing information | NO |
| SI |
| First name(s) | Alphanumeric string |
| SI |
| Last name(s) | Alphanumeric string |
| SI |
| Email address | Alphanumeric string |
| SI |
| Object containing phone information | NO |
| SI |
| Country code of the phone | Numeric string |
| SI |
| Phone number | Numeric string |
| SI |
| Object containing person/address information | NO |
| SI |
| Address line 1 | Alphanumeric string |
| SI |
| Address line 2 | Alphanumeric string |
| NO |
| City | Alphanumeric string |
| SI |
| State | Alphanumeric string |
| SI |
| Country | Alphanumeric string |
| SI |
| Object containing shipping information | NO |
| NO |
| First name(s) | Alphanumeric string |
| NO |
| Last name(s) | Alphanumeric string |
| NO |
| Email address | Alphanumeric string |
| NO |
| Object containing phone information | NO |
| NO |
| Country code of the phone | Numeric string |
| NO |
| Phone number | Numeric string |
| NO |
| Object containing person/address information | NO |
| NO |
| Address line 1 | Alphanumeric string |
| NO |
| Address line 2 | Alphanumeric string |
| NO |
| City | Alphanumeric string |
| NO |
| State | Alphanumeric string |
| NO |
| Country | Alphanumeric string |
| NO |
Ejemplo
var payload = {
"action": "authorize",
"channel": "ecommerce",
"merchant_code": "b0deb6f3-e51a-48a7-9268-f1441d46f7bd",
"merchant_operation_number": "221354",
"payment_details": {
"amount": "7000",
"currency": "604",
"billing": {
"first_name": "Levis",
"last_name": "Silvestre",
"email": "levis.silvestre@alignet.com",
"phone": {
"country_code": "+51",
"subscriber": "958435685"
},
"location": {
"line_1": "Av. San Borja Norte 1743",
"line_2": "",
"city": "Lima",
"state": "Lima",
"country": "PE"
}
},
"shipping": {
"first_name": "Levis",
"last_name": "Silvestre",
"email": "levis.silvestre@alignet.com",
"phone": {
"country_code": "+51",
"subscriber": "958435685"
},
"location": {
"line_1": "Av. San Borja Norte 1743",
"line_2": "",
"city": "Lima",
"state": "Lima",
"country": "PE"
}
},
"customer": {
"first_name": "Levis",
"last_name": "Silvestre",
"email": "levis.silvestre@alignet.com",
"phone": {
"country_code": "+51",
"subscriber": "958435685"
},
"identity_document": {
"country": "PER",
"type": "DNI",
"identifier": "72661927"
},
"location": {
"line_1": "Av. San Borja Norte 1743",
"line_2": "",
"city": "Lima",
"state": "Lima",
"country": "PE"
}
}
}
}
var paymentForm = new FlexPaymentForms({
"nonce":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJBbGlnbmV0IEpXVCBCdWlsZGVyIiwiaWF0IjoxNzEwNTQzMDAyLCJleHAiOjE3MTA1NDMwMzIsImF1ZCI6Imh0dHBzOi8vYXBpLmRldi5hbGlnbmV0LmlvIiwic3ViIjoiejhXd0FWN3JkMmpDVTBTaXZ3dFFWdjk0MWtxWmNFb3UiLCJub25jZSI6IjA0OTIwZTZjLTI0ZTgtNDYzMC05MmVkLWUxMjA2ZDg5YTNjZSIsInNjb3BlIjoiY3JlYXRlOnRva2VuIHBvc3Q6Y2hhcmdlcyB0ZXN0IiwiZ3R5IjoiY2xpZW50X2NyZWRlbnRpYWxzIn0.eOK4e_i6QaNuNlUd1or28qbPNyI3pRq19Cj-eGxqJs8",
"payload": payload,
"display_settings": {
methods: ['QR','BANK_TRANSFER','CARD']
}
});