Skip to main content
Payment Elements is AvraAPI’s optional browser package for collecting customer details and presenting payment methods. It is a UI layer only. Your server, using an AvraAPI SDK, still checks availability, creates the payment session, receives provider callbacks, and verifies completion. Use it when you want a ready-made checkout UI. You can also build your own UI and use the same server-side SDK flow.
The browser code on this page is the same whether your backend uses the PHP, Laravel, or Node.js SDK. The SDK stays on your server; Payment Elements stays in the browser.

The security boundary

Checkout Page (Frontend)

  • Payment Elements: customer form, method selector, provider presentation
  • Your checkout endpoint: handles selected gateway, mode, and customer details

Your Backend

  • AvraAPI SDK: availability(), createOrder(), completePayment()
  • Your database: manages orders and fulfilment rules
  • Provider callback: receives the verified return handler
Never send any of the following to Payment Elements or another browser script:
  • AvraAPI Project Client ID or Client Secret;
  • Gateway Vault credentials, signing secrets, API keys, or private keys;
  • a signed completionContext;
  • a trusted amount, currency, order state, merchant domain, or gateway environment.
Payment Elements receives only a public payment session created by your backend. A provider browser event is user-interface feedback, not payment confirmation. Your server must call completePayment() before it fulfils an order.

Install the browser bundle

Use the immutable AvraAPI CDN URL and the exact integrity hash published in the matching release manifest.
When you upgrade the package, change the version and integrity value together from that release’s manifest.json. Do not use a floating URL, alter the bundle, or load logo and flag assets from an unrelated host. The package exposes window.AvraAPIPaymentElements in a browser. Before mounting a checkout, you can verify that it loaded:
If the bundle is unavailable, assertLoaded() throws elements_script_missing. Show a retry message to the buyer and check your Content Security Policy and the immutable CDN URL.

Create one checkout instance

Create one instance for a checkout page, then call renderForm() and renderMethods() on that same instance. The createOrder callback is your application’s HTTPS endpoint. It is not an AvraAPI endpoint, an SDK function, or a second payment implementation.
Your endpoint must authenticate its own buyer session, load the pending order from trusted server-side storage, validate the selected gateway and mode against fresh availability, and call the SDK’s createOrder(). It must not trust an amount, environment, merchant domain, or order identity supplied by the browser.

create() options

onePaySdkFactory exists only as an internal package test seam. It is not an integration option and should not be used by applications.

Shared appearance options

renderForm() and renderMethods() accept the same appearance options. They apply only to the Elements component they render. Light defaults are a white surface with dark text. Dark defaults use a #111827 surface with light text. Use accessible colour contrast; custom colours do not alter validation, availability, or payment security.

Components and checkout flow

The page must receive server-generated availability before renderMethods() can safely use its no-methods default. Learn how this works in Render Payment Methods.

Render Customer Form

Field options, country selection, validation, and normalized phone data.

Render Payment Methods

Safe defaults, explicit methods, availability, sandbox badges, and stale-page handling.

Checkout Lifecycle

Provider presentation, browser events, errors, and the server-side completion boundary.
Last modified on October 1, 2026