Difference between revisions of "Checkout"

From Stulipan Tudástár
Jump to navigation Jump to search
 
(44 intermediate revisions by 2 users not shown)
Line 1: Line 1:
* AddToCart --> termek a Kosar (Order)-ba kerul --> Ar nelkul!!
= Gondolatok =


* Kosar - oldalon, lekerjuk az OrderItemeket, es a kapcsolodo termekek arat !!
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.


* Majd a Continue to Checkout-kor, minden egyes alkalommal OrderItembe elmentjuk a termekarat
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.


== CART >> CHECKOUT >> ORDER relationship ==
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...
 
=== 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 (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
 
 
Submitting the CustomerBasic form this happens:
<pre>CheckoutSnippets::setCustomer() >> CheckoutBuilder::setCustomerBasic() >> StoreEvent::CUSTOMER_CREATE & StoreEvent::CUSTOMER_UPDATE
</pre>
 
=== 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  
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.
* 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.
 
 
'''ABANDONED CARTS vs. ABANDONED CHECKOUTS'''
 
https://keepshoppers.com/blog/the-difference-between-abandoned-carts-and-abandoned-checkouts


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'''


=== 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.
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 ====
 
'''COUPON'''
 
* Apply coupon at Checkout (not at Cart!!)
* Apply coupon at Checkout (not at Cart!!)
* at Cart level, you know only the Savings (from sale prices)
* at Cart level, you know only the Savings (from sale prices)
Line 27: Line 78:
+ https://shopify.dev/custom-storefronts/cart:
+ https://shopify.dev/custom-storefronts/cart:


==== Considerations ====
'''Considerations'''
* The cart is subject to the same throttling restrictions as the Storefront API.
* The cart is subject to the same throttling restrictions as the Storefront API.
* The cart supports a maximum of 500 line items.
* The cart supports a maximum of 500 line items.
Line 36: Line 87:
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.
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.


== Shopify CHECKOUT attributes ==
https://shopify.dev/api/liquid/objects/checkout
+ API: https://shopify.dev/api/admin-rest/2022-01/resources/order#top


checkout.order
'''Complete the checkout'''
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:
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:


# Use the webUrl field to redirect the customer to Shopify's web checkout form.
# Use the webUrl field to redirect the customer to Shopify's web checkout form.
# Complete the checkout using one of the following methods:
# Complete the checkout using one of the following methods:
* Shopify card vault
## Shopify card vault
* Stripe
## Stripe
* Spreedly
## Spreedly
 
 
 
'''Checkout - Order viszony'''
 
Checkout -> submit -> order kreala >> lesz ilyen: checkout.order
 
* csak az Ordernek van Transactionje. Miert? Azert mert, CC fizetes eseten tobb tranzakcio is varhato (authorization, void/capture, partial/refund). Ez mind az Orderhez kell kotni.
* ez esetben, ha COD a fizetes, akkor egy Transaction letezik.
* ha CC fizetes, es nem sikeres, akkor lesz egy Checkout, es egy Order -> mindketto Abandoned
** egy honap utan torlom az Ordert. A Checkout megmarad statisztika miatt.
** ha sikeres, akkor torlom a Checkoutot (es Cartot)


== Shopify ORDER attributes ==
== Shopify ORDER attributes ==
Line 57: Line 124:




== Abandoned Carts vs. Abandoned Checkouts ==
= Egyeb =
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.
This may be a simple question but I find the documentation quite confusing.

Latest revision as of 07:34, 26 March 2022

Gondolatok[edit | edit source]

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...

AddToCart[edit | edit source]

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

Step0 - Cart[edit | edit source]

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

InitiliazeCheckout[edit | edit source]

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

Step1 - Delivery Address[edit | edit source]

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


Submitting the CustomerBasic form this happens:

CheckoutSnippets::setCustomer() >> CheckoutBuilder::setCustomerBasic() >> StoreEvent::CUSTOMER_CREATE & StoreEvent::CUSTOMER_UPDATE

Step 2 - Shipping method[edit | edit source]

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

Step3 - Payment method & Billing[edit | edit source]

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

CART >> CHECKOUT >> ORDER relationship[edit | edit source]

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.


ABANDONED CARTS vs. ABANDONED CHECKOUTS

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


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[edit | edit source]

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[edit | edit source]

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


Checkout - Order viszony

Checkout -> submit -> order kreala >> lesz ilyen: checkout.order

  • csak az Ordernek van Transactionje. Miert? Azert mert, CC fizetes eseten tobb tranzakcio is varhato (authorization, void/capture, partial/refund). Ez mind az Orderhez kell kotni.
  • ez esetben, ha COD a fizetes, akkor egy Transaction letezik.
  • ha CC fizetes, es nem sikeres, akkor lesz egy Checkout, es egy Order -> mindketto Abandoned
    • egy honap utan torlom az Ordert. A Checkout megmarad statisztika miatt.
    • ha sikeres, akkor torlom a Checkoutot (es Cartot)

Shopify ORDER attributes[edit | edit source]

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


Egyeb[edit | edit source]

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...