Skip to content
Developers

Search the guides, the API reference and the changelog.

Sign-up

Let a business customer register through Briqpay without making a purchase. Your backend creates a sign-up session, your page shows it, and a webhook and Read session give you the customer's details once they finish.

On this page

With a sign-up session, Briqpay collects a customer's details and registers them. There is no cart and no payment.

The flow follows the same three steps as the Payment Module: your backend creates a session, your page shows it, and Briqpay tells you when it is done.

How it works

  1. Your backend creates a session with product.type set to signup.
  2. Your page shows the sign-up. The session comes with an HTML snippet that embeds Briqpay's iFrame.
  3. The customer completes the sign-up. Briqpay marks the session completed, redirects the customer to your page and sends a session_status webhook.
  4. Your backend reads the session to get the customer's details.
A sign-up from start to finish
  1. Customer to Your pageVisits your registration page
  2. Your backend to BriqpayCreate session with product.type signup
  3. Briqpay to Your backendsessionId and htmlSnippet
  4. Your backend to Your pageShow the htmlSnippet
  5. Customer to BriqpayFills in the details and submits
  6. Briqpay to Your pageRedirect to urls.redirect
  7. Briqpay to Your backendsession_status webhook
  8. Your backend to BriqpayRead session
  9. Briqpay to Your backendStatus and the customer's data

Before you start

You need API credentials for the playground. Get them by registering in the Merchant Portal. See Authentication for the details.

Sign-up also has to be set up for your account in Briqpay, and country must be one of your markets.

Every request uses HTTP Basic authentication, with your merchant ID as the username and your secret as the password:

Authorization: Basic <base64(merchantId:secret)>
EnvironmentBase URL
Playgroundhttps://playground-api.briqpay.com
Productionhttps://api.briqpay.com

1. Create a session

Call Create session from your backend when the customer reaches your registration page. Never call the API from the browser: the request carries your secret.

curl -X POST 'https://playground-api.briqpay.com/v3/session' \
  -H 'Authorization: Basic <base64(merchantId:secret)>' \
  -H 'Content-Type: application/json' \
  -d '{
  "product": { "type": "signup", "intent": "signup" },
  "customerType": "business",
  "country": "SE",
  "locale": "sv-se",
  "urls": {
    "redirect": "https://example.com/redirect"
  },
  "hooks": [
    {
      "eventType": "session_status",
      "statuses": ["completed"],
      "method": "POST",
      "url": "https://example.com/notifications"
    }
  ]
}'

These fields are required: product, customerType, country, locale and urls.redirect. Unlike a payment session, a sign-up session doesn't need urls.terms.

  • product.type is signup. product.intent is optional, but if you send it, it must be signup. A payment intent is rejected with a 400.
  • customerType is business or consumer. This guide covers business customers.
  • hooks can only hold session_status events for a sign-up session. Any other event type is rejected with a 400.

The response (201) is the full session. You need two of its fields:

  • sessionId: store it. You need it to read the session.
  • htmlSnippet: the HTML that shows the sign-up on your page.

2. Show the sign-up

Put the htmlSnippet where the sign-up belongs on your page. Give it at least 640 pixels of width on desktop, and as much width as possible on mobile.

The snippet also loads Briqpay's JS SDK. If you insert the snippet with JavaScript instead of in your server-rendered HTML, add the SDK to your page's <head> yourself:

<script async src="https://api.briqpay.com/briq.min.js" id="briq-sdk"></script>

The SDK guide covers the SDK in full.

3. Handle the completed session

When the customer submits the sign-up, the session gets the status completed. Two things happen:

  • The customer's browser is sent to your urls.redirect. Briqpay redirects the top window of the page, not just the iFrame. To handle the redirect yourself, set config.disableSessionCompleteRedirect to true when you create the session.
  • Briqpay sends the session_status webhook to the URL in your hooks.

completed is the only status a session_status hook can have, and statuses is required: a hook without it is rejected. The webhook has event, status and sessionId, plus your references as top-level fields. With POST it is the request body. With GET the same fields are query parameters.

{
  "event": "session_status",
  "status": "completed",
  "sessionId": "61c16f84-b42e-4e1c-a114-a117a6e1e27d"
}

The webhook only tells you that the session is complete. It carries none of the customer's data. Webhooks can arrive more than once, and you should check that they came from Briqpay. Both are covered in Webhooks.

4. Read the customer's data

Call Read session with the sessionId, after the redirect or when the webhook arrives. Use the webhook as the trigger and treat the redirect only as the customer's return to your site.

curl 'https://playground-api.briqpay.com/v3/session/<sessionId>' \
  -H 'Authorization: Basic <base64(merchantId:secret)>'

Once the session is complete, the customer's data is in data. Each object is only present when Briqpay holds that data:

FieldWhat it holds
data.companycin (company number), name and, with some lookup providers, vatNumber
data.billingContact details and address, including companyName and cin for businesses
data.shippingDelivery address, if the sign-up collected one
data.vatValidationThe VAT number the customer gave (vatNo), whether it is valid (valid), and the session's country

Answers to a custom form, an order note or terms checkboxes you configured are returned in data.customForm1, data.orderNote and data.terms.