> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: "Checkout"
description: "Set up order placement via Rye"
---

# Setting up order placement

Below we have outlined the high-level steps involved in placing orders. The simplest way of working with Rye involves using our API end-to-end, which is possible in situations where you are *only* selling products through Rye. If you have a pre-existing checkout system with products from other sources, then it is still possible to slot Rye in but you'll need to manage your own cart and split up the order into Rye and non-Rye products.

<Steps>
  <Step title="Keep track of the shopping cart">
    Rye has a native shopping cart system that you can use to manage the checkout experience end-to-end in cases where all of your gifts are being sold through Rye. Our [tutorial](/tutorial) will help acquaint you with using the [`createCart`](/api-reference/createcart) and [`addCartItems`](/api-reference/addcartitems) mutations for this purpose. Note that you will want to call [`updateCartBuyerIdentity`](/api-reference/updatecartbuyeridentity) with the recipient's information, as the buyer identity is used for the shipping address.
  </Step>

  <Step title="Calculate the price">
    On your backend you will need to calculate the price of the cart for the gifter. The [`Cart`](/api-reference/cart) object returned from [`getCart`](/api-reference/getcart) contains a queryable [`cost`](/api-reference/cartcost) field which you can return to your frontend for display purposes, and for charging the gifter.
  </Step>

  <Step title="Charge the gifter">
    Once the gifter has indicated their payment intent, you will capture their payment method and charge them. If you already have a payment gateway in place then you can continue using that, but otherwise we recommend using [Stripe](https://docs.stripe.com/terminal/payments/collect-payment) for this purpose as it is easy to integrate.
  </Step>

  <Step title="Place the order using the Rye API">
    Once the gifter has been charged, you will have funds available to place the order through Rye. On your backend you should hit the [`submitCart`](/api-reference/submitcart) mutation to place the order. This mutation expects a `token` input, which should be a payment token for a card owned by your business.
  </Step>

  <Step title="Handle the post-checkout flow">
    From here Rye sends out webhooks whenever an order is placed, updated, or cancelled. You can use these webhooks to handle errors, or send out post-purchase notifications to the gifter and/or recipient.
  </Step>
</Steps>

We have a detailed step-by-step guide for creating carts and submitting orders on the backend which you can find [here](/placing-orders-directly-from-the-backend).

## Developer considerations

### Checkout flows

The specific details of your checkout flow will depend on whether you are exclusively transacting through the Rye API, or if you are mixing Rye products with products from other sources. There are also different considerations for checking out with a single item versus multiple items.

#### Single-item checkout

* Start by identifying which products come from Rye and which products already exist in your current database.
  * You'll need a way of distinguishing between the two programatically. A `source` field on your product objects can work well for this.
* At the time of checkout, branch depending on the source of the product:
  * **For products that come from outside Rye**: Continue with your existing flow.
  * **For products that come from Rye**: Adjust your checkout flow to ask for additional information that is required by Rye to perform a successful checkout.

#### Multi-item checkout

Just like for single-item checkout, you will need a way of distinguishing between Rye products and non-Rye products. After you have done this, there are three cases to deal with during checkout depending on the contents of the cart:

* **Only Rye products in a cart**:
  * Adjust your checkout flow to ask for additional information that is required by Rye to perform a successful checkout.
* **Only your products in a cart**:
  * Continue with your existing flow.
* **Mix of Rye and your products in a cart**:
  * Collect all information that is required by Rye.
  * During the payment step, complete the payment for Rye items via a new backend endpoint in your system which calls out to the [`submitCart`](/api-reference/submitcart) mutation.

***

## Post-checkout experience

Rye supports [order cancellations](/api-reference/cancelorder), [refunds](/refunds), and [returns](/returns). Please review instructions in your console and the relevant documentation.

**FAQs**

* **Is there any marketplace, such as Shopify or Amazon, where you can include a note with the order or offer a gift-wrap option?**

  We currently don't provide the option to add notes, but we can verify if it's feasible.


---

*Powered by [holocron.so](https://holocron.so)*
