Once the cart is complete and shipping information is set, you're ready to initiate checkout. This step creates a payment session using your configured gateway (e.g. Stripe). The customer is then redirected to a secure hosted checkout page to complete their purchase.
This section covers:
- Checkout overview
- Customizing the checkout flow
- Common checkout errors
πNote: Full request/response schemas are available in the API reference
πΒ Checkout Overview
- Checkout is triggered via a single API call
- A secure payment session is created
- A
urlis returned β redirect the user to this page to complete payment
Endpoint: POST /checkout/:cart_id
Response:
json
JavaScript Example:
javascript
π³ Sample Hosted Checkout Page

π‘Testing your flow: Use test cards such asΒ 4242 4242 4242 4242 with:
A valid future date, such asΒ 12/34
Any 3-digit CVC (or 4-digit for Amex)
Any name, address, or other form fields.
For more options, see Stripe Documentation
π οΈ Customizing the Checkout Flow
Diddo supports flexible checkout configurations depending on your needs:
- Hosted Checkout (default): Stripe-hosted, secure, and compliant
- Embedded Checkout: Integrate Stripe Elements for a fully branded frontend experience
- Custom Gateways: Have your own payment provider? We can support it with a tailored flow
π¬Need a custom setup? Contact our team to configure embedded flows, multi-gateway support or custom integrations.
β οΈ Common Checkout Validation Errors
Before a checkout session is created, the API validates the cart for completeness. If any required information is missing or invalid, the request will return a structured error response with an appropriate HTTP status code.
π Cart Not Found
- Status:
400 Bad Request - Code:
CART_NOT_FOUND
json
π Cart Already Submitted
- Status:
409 Conflict - Code:
ALREADY_SUBMITTED - Reason: A checkout session has already been created for this cart.
json
π€ Missing Buyer Information
- Status:
400 Bad Request - Code:
BUYER_IDENTITY_MISSING - Reason: Customer information is required before proceeding to checkout.
json
π° Missing Total Cost
- Status:
400 Bad Request - Code:
MISSING_TOTAL_COST - Reason: Cart has no total cost value. Typically indicates misconfigured pricing or variants.
json
π¬ Missing Store Information
- Status:
400 Bad Request - Code:
MISSING_STORESorMISSING_STORE_DOMAIN - Reason: Every cart must contain at least one valid store with a domain.
json
π Shipping Method Not Selected
- Status:
422 Unprocessable Entity - Code:
SHIPPING_ADDRESS_UNAVAILABLE - Reason: A shipping method must be selected before initiating checkout.
json
π¦ Missing or Invalid Cart Lines
- Status:
400 Bad Request - Code:
MISSING_CART_LINESorVARIANT_NOT_FOUND - Reason: Cart items are missing or improperly configured.
json
π‘Frontend Tip: Validate the cart state before initiating checkout to avoid unnecessary API calls and user friction. See Error Handling for recovery strategies and retry logic.
