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
- Your backend creates a session with
product.typeset tosignup. - Your page shows the sign-up. The session comes with an HTML snippet that embeds Briqpay's iFrame.
- The customer completes the sign-up. Briqpay marks the session
completed, redirects the customer to your page and sends asession_statuswebhook. - Your backend reads the session to get the customer's details.
- Customer to Your pageVisits your registration page
- Your backend to BriqpayCreate session with product.type signup
- Briqpay to Your backend
sessionIdandhtmlSnippet - Your backend to Your pageShow the
htmlSnippet - Customer to BriqpayFills in the details and submits
- Briqpay to Your pageRedirect to urls.redirect
- Briqpay to Your backend
session_statuswebhook - Your backend to BriqpayRead session
- 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)>| Environment | Base URL |
|---|---|
| Playground | https://playground-api.briqpay.com |
| Production | https://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.typeissignup.product.intentis optional, but if you send it, it must besignup. A payment intent is rejected with a400.customerTypeisbusinessorconsumer. This guide covers business customers.hookscan only holdsession_statusevents for a sign-up session. Any other event type is rejected with a400.
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, setconfig.disableSessionCompleteRedirecttotruewhen you create the session. - Briqpay sends the
session_statuswebhook to the URL in yourhooks.
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:
| Field | What it holds |
|---|---|
data.company | cin (company number), name and, with some lookup providers, vatNumber |
data.billing | Contact details and address, including companyName and cin for businesses |
data.shipping | Delivery address, if the sign-up collected one |
data.vatValidation | The 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.