Advanced Options
Advanced Options
Here you can find some examples of advanced workflow customization for PrimeiroPay. Each of the examples provided use the wpwlOptions
variable, the full reference for which can be found on our PrimeiroPay API Reference.
Please note that JavaScript examples from PrimeiroPay can be used only when including jQuery.
Have card holder mandatory
By default the card holder is optional. Some integrations would like to have it mandatory. In order to achieve this we can implement the check on the onBeforeSubmitCard event, like below:
Prepare the checkout
Using the wpwlOptions API onBeforeCardSubmit event, check if the holder contains 2 or more characters.
html
css
js
Result
Add custom fields
You can add additional parameters to the payment form using the wpwlOptions
variable, prior to loading Primeiro Pay. In the example above, we add a custom parameter to the payment form for recording the number of installments requested by the customer. The steps are listed below.
Prepare the checkout
Using the wpwlOptions API onLoad event, add the custom field HTML to the payment form
Set the name of the html input field to your API parameter e.g. recurring.numberOfInstallments
html
css
js
Result
Change label
You can change a label in the payment form using the wpwlOptions
variable, prior to loading the Primeiro Pay payment widget. In the following example, we'll change the credit card brand label in the payment form.
Prepare the order
Using the wpwlOptions API onLoad event, use a JQuery selector to set the desired value of the label
html
css
js
Result
Last updated