Adding a Checkout button
This is still in the works. If you need immediate support, please reach out to your topi point of contact.
We have developed topi Elements, a small JavaScript UI library, to do the heavy lifting of displaying prices and other UI elements on your shop. It's free to use and continually updated. Have a look!
The Cart page is different from the Product detail page or the Product listing page, because here you would need to know not just the rental prices of each rentable product, but also whether the customer can checkout the whole cart with topi. To find out, pass your cart's products to the cartRentalOverview
endpoint:
{
"products": [
{
"price": {...},
"quantity": 2,
"seller_product_reference": {...}
},
{...},
{...}
]
}
For which you'd get a response with this shape:
{
"can_checkout": true,
"currency": "EUR",
"product_prices": [
{...},
{...},
{...}
],
"total_rental_amount": 595000
}
Can this cart checkout?
If the cart can be checked out, then the top-level can_checkout
would be true. If any of the products in the cart cannot be checked out with topi, then it would be false.