1. Create a payment session
info
This step is performed by your backend.
Create a B2B checkout 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/payment-tools/session
Headers / Authentication
The format of the Authentication header is Basic <base64(username:secret)>
.
The username/secret is retreived/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": "business",
"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"
}
],
"data": {
"order": {
"currency": "SEK",
"amountIncVat": 2700,
"cart": [
{
"productType": "physical",
"reference": "testproduct1",
"name": "Test product",
"quantity": 2,
"quantityUnit": "pc",
"unitPrice": 1200,
"taxRate": 2500,
"discountPercentage": 1000
}
]
}
}
}
Creating a B2B/B2C "Payment module" session
Briqpay Payment Module lets you handle data collection yourself while letting us take care of payments.
Provide a list of modules to load
Make a POST request to the Create session endpoint. The only difference to the example above (Creating a B2B checkout session) is that you should also provide modules.loadModules
to load only the wanted modules.
{
"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.