Skip to main content
This guide covers the complete lifecycle of a one-time payment: creating a customer record, creating a payment object, routing the customer through a hosted checkout session, and confirming the charge succeeded on return. By the end you will have a working end-to-end flow that you can adapt for any e-commerce or service billing scenario.
Borga amounts are expressed in whole Icelandic króna (ISK). ISK has no subunit — pass 5990 to charge 5,990 kr, not 59.90 kr.
1

Create a customer (optional)

Creating a customer record before charging lets you attach payment history, save payment methods, and link subscriptions or invoices to a single identity. If you do not yet have a customer in Borga, create one now.
Save the returned id (e.g. cus_01HXYZ…). You will pass it as the customer field in subsequent requests to link activity to this person.
2

Create a payment

A payment object represents a single charge attempt. Create one with the amount to collect, the currency, and an optional description that will appear on the invoice.
A successful response returns the payment object with a pending status:
Save the id. You will attach it to a payment session in the next step and poll it after checkout to confirm success.
Store your internal order ID in the external_reference field. It is indexed, so you can look up the Borga payment from your own system without needing to track the Borga id separately.
3

Create a payment session

A payment session hosts the checkout UI and handles 3D Secure redirects for you. Pass the payment id you just created so the session is linked to it, and provide a return_url where Borga will send the customer after checkout.
The response includes a url property pointing to the hosted checkout page on checkout.borga.is.
4

Redirect the customer

Redirect the customer’s browser to session.url. Borga’s hosted checkout page handles all payment method presentation — cards, Apple Pay, Google Pay, and krafa — without any additional code on your side.
Node.js (Express)
When the customer completes or abandons checkout, Borga redirects them back to the return_url or cancel_url you specified.
5

Confirm success

On the page that handles your return_url, retrieve the payment to verify its status before fulfilling the order.
A confirmed charge returns a status of "succeeded":
Do not fulfil the order based solely on the return_url redirect. The customer’s browser could be manipulated. Always fetch the payment server-side and check status === "succeeded" before fulfilling. For production integrations, use webhooks to receive asynchronous confirmation.

Issue a refund

If you need to refund a succeeded payment, use POST /v1/refunds. Omit amount to refund the full charge.
curl
Borga automatically generates a credit note linked to the original invoice when a refund is issued.

Next steps

  • Hosted checkout — configure the checkout page appearance, locale, and payment methods
  • Webhooks — receive asynchronous payment.succeeded and payment.failed events
  • Subscriptions — set up recurring billing for the same customer