renderForm() renders the buyer-details form used before your backend creates a payment session. It collects data; it does not create an order, contact a gateway, or confirm payment.
Create the Elements instance once, then render into a CSS selector or an existing DOM Element.
renderForm() again on the same Elements instance destroys the previous form before mounting the new one. Call form.destroy() or elements.destroy() when your checkout page unmounts.
Customer fields
The package renders these fields in this order.
The country selector has keyboard access and search. On narrow screens, the form becomes a single column.
All renderForm() options
Required, optional, and excluded fields
Default-required fields remain visible even if listed inexclude. To omit a default-required field, first make it optional.
Labels and a compact form
Read the form result
form.value() returns the fields currently rendered by the component. It returns the country name, the phone number in an E.164-style format, and the selected dial code.
+, the package preserves that international number after removing spaces and common punctuation. Otherwise it combines the selected dial code with the entered national number and removes one leading 0 from that local part.
Do not use this client-side normalization as proof that a phone number is valid or owned. Apply your own server-side validation and any gateway-specific requirements.
Send details to your backend endpoint
checkout() reads the mounted form automatically and passes its value to the createOrder callback together with the selected gateway, mode, and public providerOptions.
/your-checkout-endpoint is a placeholder for a route in your application. Your backend loads its own order, checks the allowed method against fresh availability, validates customer, and uses the AvraAPI SDK. It must not accept a browser value as the final amount, currency, order ID, gateway environment, or completion authority.
Continue with Render Payment Methods.
