Api

Configure services

You can use mockServer from geta-checkout to test using dummy data.

import { mockServer, CartApi } from 'geta-checkout';
const cartApi = new CartApi(mockServer.cartServices);

You may find the boilerplate below useful when implementing the service layer.
The exact implementation will depend on your project.
Service-layer in this context is just a fancy word for functions that send ajax-requests, receive json-responses and return promises.

Add a custom API

If the built-in APIs don't cover your needs, you may want to build your own API.
You can copy and modify one of the built-in APIs, or use the simple boilerplate / pattern below.

Note that the example below has only one dependency to Geta Checkout; the render method.
The API code itself is just plain JavaScript.

This may look like a lot of code to display a random number.
However, as the complexity of the project grows, the pattern below will start to make a lot more sense.