# New Checkout Flow

When implementing the checkout API with the dashboard, there are five practical stages you will need to implement with each stage having various API routes to aid with their integration.

<details>

<summary>Product / Stock - Stock API Route</summary>

This section includes showing the customer the product with the available stock and allowing to select the exact price\_id and quantity.

You can use the stock endpoint for this operation, it includes product names, pricing options and product stock.

</details>

<details>

<summary>Cart - Cart Calculation API Route</summary>

This endpoint allows you to send in a line\_items object with the respective price\_id and quantity of the order and receive a pricing quote with calculations including applying customer credit to the order

At this stage, it should called without validate\_payment\_platform as that increases API response time.

This stage also includes applying discount codes and validation as well as calculation price inclusive of discount codes.

</details>

<details>

<summary>Payment Platform Selection - Cart Calculation API Route</summary>

At this stage, the Cart Calculation API Route can called with **validate\_payment\_platform** as will now provide a full list of available payment methods for the top\_up or service checkout.

This route has complex logic and will provide a list of all allowed payment methods and saved cards based on the current customer, their IP address location and the size of the order.

Any disallowed payment methods are also listed with the reason they are disallowed. For example, a customer in Indonesia would have Bitpay disallowed their as it is banned in that region and a cart with a value of $8 wouldn't be able to use ETH on Coinpayments as it is under the minimum ETH order value.

You can then use the values returned by this route in your call to the **Checkout API Route** to ensure your values will be accepted as they are pre-validated.

</details>

<details>

<summary>Redirect to Payment Platform / Capture Payment - Checkout API Route</summary>

At this stage, you can use the Checkout API Route by sending in your checkout details including line\_items or is\_top\_up with your respective payment method of choice.

You should only use payment methods which are validated by the Cart Calculation API for the specific cart.

</details>

<details>

<summary>Show Order Confirmation / Placed Page</summary>

This is the final stage and will show the customer the customer a page indicating the order or top\_up has been placed.

</details>

{% hint style="info" %}
You can either process a credit  top up via the checkout flow or place an order for a service.
{% endhint %}

{% hint style="info" %}
Only a single service type can be checked out at a single time.&#x20;
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://internal.developer.documentation.private.user.pingproxies.com/checkout-and-payments/new-checkout-flow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
