Skip to Content

Payment page

A ready-made payment page for every payment, in your business's look, that can also open on top of your site.

Every payment has its own payment page at checkout_url, for example https://pay.piti.id/pay/pay_8Fq2.... You don't need to build a payment screen.

How to use it

After you create a payment, send the customer to checkout_url:

  • redirect from your checkout,
  • send it as a link by WhatsApp, email or chat,
  • or open it on top of your site with embed.js.

What the page shows

  • Your business name and logo, the amount to pay (total) and the description.
  • The amount + service fee breakdown when the customer pays a VA fee.
  • By method:
    • QRIS: the QR code. The page renews the QR before it runs out.
    • Virtual account: the bank, the VA number with a copy button, and the exact amount to transfer.
    • method: any: the methods the customer can pick from. See Customer picks the method.
  • A countdown to the payment's expires_at.
  • A status that updates by itself: paid, expired, or refunded.
  • Your reference at the bottom.
  • In test mode: a test-mode banner and a simulate button. See Testing.

Back to your site: return_url

Send return_url when you create the payment:

{ "amount": 150000, "reference": "INV-1042", "return_url": "https://shop.example/orders/1042" }
  • It must be an https URL (http is also allowed in test mode), at most 2048 characters. Otherwise 400 invalid_request.
  • Once paid, the page shows a Kembali ke (back to) button with your business name, and takes the customer to return_url by itself about 3 seconds later.
  • Without return_url, we use the app's default return URL (see below). If that is empty too, the customer stays on the payment page with the success message.

Default return URL per app

Set it in the dashboard: Developer → your app → Pengaturan (Settings) → URL kembali. It applies to every payment of that app that has no return_url of its own, including dashboard invoices and recurring invoices, which have no URL field.

  • It must be https, in test mode too, because it applies to test and live payments.
  • A payment's own return_url always wins. In compatibility modes, success_redirect_url (Xendit) and returnUrl (Duitku) count as the payment's return_url.
  • The default is read when the payment page opens, so changing it also applies to payments that are still open.
  • The API's return_url field holds only the URL you sent for that payment (null if none), not the default.

A customer coming back is not proof of payment

Anyone can open return_url. Before you deliver, make sure the payment is paid on your server: through the payment.paid webhook or GET /v1/payments/{id}.

Your business's look

Set it in the dashboard under Tampilan (appearance). There is a live preview before you save.

  • Business name customers see: 1 to 60 characters.
  • Logo: PNG, JPEG or WEBP, at most 48 KB. SVG is not accepted.
  • Brand colour: a #rrggbb code. The text on it (white or black) is picked for you so it stays readable.
  • Theme: Klasik (classic, the default), Modern, Lembut (soft), Minimal or Gelap (dark).

The look applies to the whole business, in every app, including payments already made.

Open it on top of your site

With embed.js, the payment page opens as a window on top of your page, without leaving your site.

checkout.html
<script src="https://pay.piti.id/embed.js"></script>
<button id="pay">Pay</button>
<script>
  document.getElementById('pay').addEventListener('click', function () {
    // checkout_url of the payment your server created
    LayerbeatPay.open(checkoutUrl, {
      onPaid: function (e) {
        // e.id, e.status, e.reference
        // Confirm on your server before you deliver.
      },
      onExpired: function (e) {},
      onClose: function () {},
    });
  });
</script>

With no JavaScript of your own, add the data-layerbeat-checkout attribute to a link:

<script src="https://pay.piti.id/embed.js"></script>
<a href="https://pay.piti.id/pay/pay_8Fq2..." data-layerbeat-checkout>Pay</a>

How it works:

LayerbeatPay.open(url, options)Opens the payment page url (it must be one of our checkout_urls) in a window. One window at a time. Any other URL throws an error.
LayerbeatPay.close()Closes the window.
onPaid(e)The payment is paid. e has id, status and reference. The window closes by itself 2.5 seconds later.
onExpired(e)The payment expired. Same e.
onClose()The window closed: the × button, the Escape key, a click outside the window, or after payment.
  • Inside the window, the page does not go to return_url. Your page decides what happens next.
  • We only accept messages from our payment page in that window.
  • The plain payment page cannot be put in your own iframe. Use embed.js.

A browser callback is not proof of payment

onPaid runs in the customer's browser. Before you deliver, always confirm on your server with the payment.paid webhook or GET /v1/payments/{id}.