Skip to content

Embedded checkout

Embedded checkout puts Pesepay’s payment fields on your own page. The customer picks a method, types their details and pays without leaving your site. Every method works, including Visa and Mastercard with 3-D Secure, and card details never reach your page or your servers.

The fields are Pesepay Elements: components you mount into your page from a script tag or from npm, with packages for React, Vue and Angular. The checkout element is a payment form, Pay button included, that you place inside your own checkout page rather than sending the customer to ours.

  1. 1 Your server creates the payment
  2. 2 Your page mounts the checkout element
  3. 3 The customer pays in the element
  4. 4 Your server confirms the payment
  1. Your server creates the transaction with your integration and encryption keys, the same call Hosted checkout uses, and gets back a reference number. Neither key goes near the browser.
  2. Your page passes that reference number to Elements, which lists the methods the transaction can be paid with and shows each one’s fields.
  3. The customer pays with the element’s own Pay button. The element runs every step, from 3-D Secure to waiting for an EcoCash approval, then shows the result and tells your page how the payment ended. To use your own Pay button instead, see Custom payment flow.
  4. Your server checks the transaction before it fulfils the order. What the browser reports is for your page; only your server’s check is proof of payment.

Creating the transaction and checking it on your server are the same as in every Pesepay integration. See How payments work and The result callback. Already on the Direct API? See Migrate from the Direct API.

Elements loads its code from js.pesepay.com, so fixes reach your checkout without a redeploy. Card fields run in a frame served from a Pesepay origin: your page can place and style it, but cannot read what is typed into it. For Mastercard and Zimswitch, the customer types the card number into the card provider’s own form, which keeps it off your page in the same way.

The checkout element shows every method the transaction can be paid with, with the total and fee for the one the customer picks.

MethodWhat the customer does
VisaTypes the card into Pesepay’s card fields, then 3-D Secure
Mastercard, ZimswitchPays in the card provider’s form inside the element
EcoCashApproves a prompt on their phone
O’mariTypes the code sent to them by SMS
InnBucks, PayGoScans a code with the provider’s app

Each kind has a guide: Cards and 3-D Secure, Mobile money approval and Scan to pay. The payment methods pages cover limits and currencies for each one. Before you go live, read Accept a payment.

The loader and TypeScript types, for any page or framework.

npm install @pesepay/js

React components and hooks. React 18 or 19.

npm install @pesepay/js @pesepay/react

Vue components and composables. Vue 3.5 or later.

npm install @pesepay/js @pesepay/vue

Standalone Angular components. Angular 22 or later.

npm install @pesepay/js @pesepay/angular

The framework packages wrap the same elements as components and build on @pesepay/js. You can also skip npm and load https://js.pesepay.com/v1/pesepay.js with a script tag, as the @pesepay/js page shows. The quickstart shows all five ways, and every export is in the Elements SDK reference.