1. Create a payment session
This step is performed by your backend.
Create a session
Make a POST request to the Create session endpoint, providing relevant information such as the country, locale and order details.
Request URL
POST https://playground-api.briqpay.com/v3/session
Headers / Authentication
The format of the Authentication header is Basic <base64(username:secret)>
.
The username/secret is retrieved/generated from the backoffice keys page.
{
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Basic <base64(username:secret)>"
}
Body
{
"product": {
"type": "payment",
"intent": "payment_one_time"
},
"customerType": "consumer",
"country": "SE",
"locale": "sv-se",
"urls": {
"terms": "https://example.com/terms",
"redirect": "https://example.com/redirect"
},
"hooks": [
{
"eventType": "order_status",
"statuses": ["order_pending", "order_rejected", "order_cancelled", "order_approved_not_captured"],
"method": "POST",
"url": "https://example.com/notifications"
},
{
"eventType": "capture_status",
"statuses": ["pending", "approved", "rejected"],
"method": "POST",
"url": "https://example.com/notifications"
},
{
"eventType": "refund_status",
"statuses": ["pending", "approved", "rejected"],
"method": "POST",
"url": "https://example.com/notifications"
}
],
"modules": {
"loadModules": ["payment"]
},
"data": {
"consumer": {
"identificationNumber": "197001011234",
"dateOfBirth": "1970-01-01"
},
"billing": {
"streetAddress": "Teststreet 1",
"streetAddress2": "Teststreet 2",
"zip": "12345",
"city": "Test city",
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"phoneNumber": "0730000000"
},
"shipping": {
"streetAddress": "Teststreet 1",
"streetAddress2": "Teststreet 2",
"zip": "12345",
"city": "Test city",
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"phoneNumber": "0730000000"
},
"order": {
"currency": "SEK",
"amountIncVat": 3000,
"amountExVat": 2400,
"cart": [
{
"productType": "physical",
"reference": "testproduct1",
"name": "Test product",
"quantity": 2,
"quantityUnit": "pc",
"unitPrice": 1200,
"taxRate": 2500,
"discountPercentage": 0
}
]
}
}
}
Creating a customer specific session
Briqpay Payment Module lets you handle data collection yourself while letting us take care of payments, meanwhile the Briqpay B2B checkout will collect the address for you.
Provide a list of modules to load
Make a POST request to the Create session endpoint. Via the session API it is possible to render different modules by supplying modules.loadModules
. In order to render the Briqpay B2B checkout no modules are required to be passed (Briqpay will perform the address collection in the Checkout)
{
"modules": {
"loadModules": ["payment"]
}
}
Notes
- You can also specify which type of customer this session is intended for with the
customerType
parameter asbusiness
orconsumer
. - If you do not submit billing details (+ company for businesses), the payment module will be locked until the session is updated with the required data. You can manually unlock the payment module with the
unlockModule
SDK function documented here.