Create a session from your backend
In order to use a component of Pay.Parts in your frontend you need to initialize a session. A session is initialized by sending a POST request from your backend.
Base URL
The following URLs are available:
Production: https://parts.pay.nl [NOT AVAILABLE YET]
Beta (Production): https://zero-parts.pay.nl
Authentication
Session Create (Basic Auth)
The POST /v1/session/start endpoint uses HTTP Basic Authentication with your Sales Location credentials:
Authorization: Basic <base64(sl-code:secret)>Session Get (Basic Auth)
The GET /v1/session/{sessionId} endpoint uses Basic Authentication with your Sales Location credentials (same as create session):
Authorization: Basic <base64(sl-code:secret)>Endpoints
Create Session
Create a new payment session.
Endpoint: POST /v1/session/start
Authentication: Basic Auth (SL-CODE:SECRET)
Minimum Required Request
curl -X POST "https://zero-parts.pay.nl/v1/session/start" \
-H "Content-Type: application/json" \
-H "Authorization: Basic $(echo -n 'SL-1234-4321:your-secret-key' | base64)" \
-d '{
"returnUrl": "https://shop.nl/return",
"exchangeUrl": "https://shop.nl/exchange",
"amount": {
"value": 100,
"currency": "EUR"
}
}'Full Request with Optional Fields
curl -X POST "https://zero-parts.pay.nl/v1/session/start" \
-H "Content-Type: application/json" \
-H "Authorization: Basic $(echo -n 'SL-1234-4321:your-secret-key' | base64)" \
-d '{
"returnUrl": "https://shop.nl/return",
"exchangeUrl": "https://shop.nl/exchange",
"amount": {
"value": 2999,
"currency": "EUR"
},
"description": "Order #12345",
"reference": "REF-12345",
"expire": "2025-12-31T23:59:59Z",
"customer": {
"locale": "nl-NL",
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"phone": "+31612345678",
"address": {
"street": "Keizersgracht",
"houseNumber": "126",
"postalCode": "1015CW",
"city": "Amsterdam",
"country": "NL"
}
},
"order": {
"products": [
{
"description": "Product A",
"quantity": 1,
"unitPrice": 1000,
"total": 1000,
"productId": "PROD-001",
"vatPercentage": 21
},
{
"description": "Product B",
"quantity": 2,
"unitPrice": 999,
"total": 1998,
"productId": "PROD-002",
"vatPercentage": 21
}
],
"shippingCosts": 0,
"totalVat": 629
}
}'Successful Response
{
"sessionId": "a3fc44c532784ce1b8ac2f2a003e1239",
"sessionToken": "st_eyJTZXNzaW9uSWQiOiJhM2ZjNDRjNTMyNzg0Y2UxYjhhYzJmMmEwMDNlMTIzOSIsIkNvbmZpZyI6eyJtZXJjaGFudE5hbWUiOiJDYW55b24gQmlrZXMiLCJhbW91bnQiOnsidmFsdWUiOjI5OTksImN1cnJlbmN5IjoiRVVSIiwiZm9ybWF0dGVkIjoiMjk5Ljk5In19fQ=="
}Get a session
Retrieve session details. Returns the same session token, amount, customer, and order that were used when creating the session.
Endpoint: GET /v1/session/{sessionId}
Authentication: Basic Auth (SL-CODE:SECRET)
curl -X GET "https://zero-parts.pay.nl/v1/session/a3fc44c532784ce1b8ac2f2a003e1239" \
-H "Authorization: Basic $(echo -n 'SL-1234-4321:your-secret-key' | base64)"Successful Response
{
"sessionId": "a3fc44c532784ce1b8ac2f2a003e1239",
"sessionToken": "st_eyJTZXNzaW9uSWQiOiJhM2ZjNDRjNTMyNzg0Y2UxYjhhYzJmMmEwMDNlMTIzOSIsIkNvbmZpZyI6eyJtZXJjaGFudE5hbWUiOiJDYW55b24gQmlrZXMiLCJhbW91bnQiOnsidmFsdWUiOjI5OTksImN1cnJlbmN5IjoiRVVSIiwiZm9ybWF0dGVkIjoiMjk5Ljk5In19fQ==",
"amount": {
"value": 2999,
"currency": "EUR"
},
"customer": {
"locale": "nl-NL",
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"phone": "+31612345678",
"address": {
"street": "Keizersgracht",
"houseNumber": "126",
"postalCode": "1015CW",
"city": "Amsterdam",
"country": "NL"
}
},
"order": {
"products": [
{
"description": "Product A",
"quantity": 1,
"unitPrice": 1000,
"total": 1000,
"productId": "PROD-001",
"vatPercentage": 21
}
],
"shippingCosts": 0,
"totalVat": 210
}
}Updated about 1 month ago