Difference between revisions of "Checkout"

From Stulipan Tudástár
Jump to navigation Jump to search
Line 29: Line 29:
* we have the Cart
* we have the Cart
* we import items from Cart >> we have CheckoutItems
* we import items from Cart >> we have CheckoutItems
* each time we update items with quantity and prices


=== Step1 - Delivery Address ===
=== Step1 - Delivery Address ===

Revision as of 10:08, 21 February 2022

In my own logic, the Cart is temporary and it should expire. It can only exist until the cookie expires. Otherwise, it can't be linked to a user/buyer.

When the buyer enters an email address the Cart becomes a Checkout. Thus the Checkout will exist until the order is placed and the Checkout becomes an Order. As a result, as soon as it is created a Checkout is in fact an Abandoned Checkout.

The Order is the final destination. If the Order is created from a Checkout, then the Checkout will be deleted from database. Another way to create an Order is to create it in the admin.

In theory, the Transaction can be considered the true final destination, meaning that an Order becomes a Transaction. Ezt még át kell gondolni...


Gondolatok

  • AddToCart --> termek a Kosar (Order)-ba kerul --> Ar nelkul!!
  • Kosar - oldalon, lekerjuk az OrderItemeket, es a kapcsolodo termekek arat !!
  • Majd a Continue to Checkout-kor, minden egyes alkalommal OrderItembe elmentjuk a termekarat

AddToCart

  • we add a product to the cart
  • the Cart is created
  • we have CartItems

Step0 - Cart

  • If items are present:
  • we have the Cart
  • we have items >> CartItems

InitiliazeCheckout

  • we have the Cart
  • we import items from Cart >> we have CheckoutItems
  • each time we update items with quantity and prices

Step1 - Delivery Address

  • we have Checkout entity
  • we have items in Checkout
  • no email address in Checkout yet
  • no Customer entity yet
  • no Recipient

Step 2 - Shipping method

  • we have Customer entity
  • we have Recipient
  • no Shipping method

Step3 - Payment method & Billing

  • we have Shipping method
  • no Payment
  • no Sender yet

CART >> CHECKOUT >> ORDER relationship

https://community.shopify.com/c/shopify-apis-and-sdks/difference-between-webhook-quot-checkout-create-quot-quot-orders/td-p/484679

  • A checkout/create event is fired when a checkout is initiated. That means that a user proceeds from their cart to checkout and the cart line items are "transferred" to the checkout line items. As the user enters data throughout the stages of checkout, personal details, shipping, shipping address, payment method, billing address etc. the checkout/update fires.
  • The orders/create event is fired once the checkout is completed i.e. the user successfully completes all checkout steps and is presented with the checkout order summary screen. However, this event is also fired when you manually create an order in Admin UI or if you mark a draft order as paid i.e. the draft order progresses to become an actual order.
  • A checkout/update event is fired when a customer with an active checkout makes updates to their cart during checkout.

FROM SHOPIFY

When a customer reaches the payment method page of the checkout, their cart is checked against your store's inventory levels. If the inventory is available, then it is held for the customer while they complete the payment. If the inventory has become unavailable, then an error message appears. If a payment fails, then the hold is released until the customer reaches the payment method page again.

COUPON

  • Apply coupon at Checkout (not at Cart!!)
  • at Cart level, you know only the Savings (from sale prices)
  • therefore Savings and Coupon discounts are 2 different things

Shopify CART attributes

https://shopify.dev/api/liquid/objects/cart +API: https://shopify.dev/api/admin-rest/2022-01/resources/checkout#resource_object + https://shopify.dev/custom-storefronts/cart:

Considerations

  • The cart is subject to the same throttling restrictions as the Storefront API.
  • The cart supports a maximum of 500 line items.
  • A shop or customer can create an unlimited number of carts.
  • Unused and abandoned carts are auto-expired 10 days after creation by Shopify.
  • Shopify automatically deletes the cart when the customer completes their checkout.

When a cart is created an id is assigned to it and it has an expiration which is set in cookie with name "cart" this token is also delivered in webhook post callbacks as id and cart_token in carts_update and checkout event.


Shopify CHECKOUT attributes

Attributes: https://shopify.dev/api/liquid/objects/checkout

API: https://shopify.dev/api/admin-rest/2022-01/resources/order#top

checkout.order

Returns the order created by the checkout. Depending on the payment provider, the order might not have been created yet on the checkout order status page and this property could be nil.

Complete the checkout

After you've finished creating and performing any updates to the checkout, you can complete the checkout. There are several ways to complete a checkout:

  1. Use the webUrl field to redirect the customer to Shopify's web checkout form.
  2. Complete the checkout using one of the following methods:
    1. Shopify card vault
    2. Stripe
    3. Spreedly

Shopify ORDER attributes

https://shopify.dev/api/liquid/objects/order


Abandoned Carts vs. Abandoned Checkouts

https://keepshoppers.com/blog/the-difference-between-abandoned-carts-and-abandoned-checkouts

Egyeb

This may be a simple question but I find the documentation quite confusing.

The REST API document shows the following entities: Abandoned checkouts, Order, Transaction

The webhook API document shows the following entities: Cart, Checkout, Order, OrderTransaction

What is the relationship between all these entities? And what is the overall flow.

Is like this: Cart => Checkout => Order => Transaction?

Why is the terminology different for both APIs?

For example:

Is a checkout always abandoned?

Is a transaction the same as an order transaction?

Why can't I retrieve Carts with the REST api?

Can I expect the same fields in both the REST and the webhook API?

For a given webhook entity, can I expect the same fields for the various topics (e.g checkouts/create and checkouts/delete)

What causes a checkout to be deleted?

Do carts ever get deleted?

This is all very confusing...