Integration Flow
This integration flow is specific to E-Commerce payment flows. For Point of Sale (POS) flows please refer to our POS documentation
Flow description
1.From the checkout process on the Merchant Site, the customer chooses to pay with Laybuy.
2. The Merchant Server creates a new Laybuy order by making a request to the Laybuy API and passing the order details.
3. If the request fails, an error is displayed on the Merchant Site.
4. If the request is successful, the Laybuy API returns a payment token and the payment URL. The token can be stored by the Merchant Server, and the customer is redirected to the payment URL to begin the payment process.
5. The customer proceeds through the payment process on the Laybuy Payment site.
6. When the payment process is completed, the customer is redirected to the return URL.
7. If the payment failed, an error is displayed on the Merchant Site.
8. If the payment is successful, then when the customer and merchant are ready to complete the order process then the Merchant Server will attempt to confirm the payment by making a request to the Laybuy API.
9. If the confirmation failed, an error is displayed on the Merchant Site.
10. If the confirmation was successful, the customer is shown an order confirmation page on the Merchant Site
API End Points
Production
https://api.laybuy.com/
Sandbox
https://sandbox-api.laybuy.com/
Authentication
The Laybuy API uses Basic Authentication, where the username is your merchant ID and the password is your API key. These details are available from the merchant interface.
curl 'https://api.laybuy.com/order/create' -u '{merchantId}:{apiKey}'
<? $authHeader = 'Authorization: Basic ' . base64_encode($merchantId . ':' . $apiKey); ?>
Requests
The Laybuy Merchant API is REST-based.
Accepts and returns only JSON data.
All communication must be completed securely using HTTPS