Synchronization of a basket and an order

Basket synchronization initiated at the Merchant store's website:

  1. The Client goes to the Merchant's website.

  2. The Merchant builds the store's website with an embedded widget with the message:

    1. "Utwórz koszyk z InPost Pay (Create basket in InPost Pay) "– the widget embedded on the product card

      image-20240320-135256.png

    2. "Kup z InPost Pay (Buy with InPost Pay)" -the widget embedded in the basket

      image-20240320-135329.png

       

  3. The customer presses the widget "Utwórz koszyk z InPost Pay (create a basket with InPost Pay) "or "Kup z InPost Pay (Buy with InPost Pay)".

  4. The Widget verifies in the Merchant's backend, whether or not the chosen product is available for adding to the basket (iziCanBeBound).

  5. At the first method called by the Widget, the Merchant's backend calls the method to InPost Pay to verify whether or not the customer's basket is bound to InPost Pay, and whether or not the browser the customer currently uses is among the trusted ones. The verification takes place through the request GET/v1/izi/basket/{basket_id}/binding.

  6. InPost Pay returns the information that the basket is linked (basket_linked=true) or the basket is not linked (basket_linked=false), and the browser is trusted (browser_trusted=true).

  7. The Merchant's backend refreshes the store's website together with the updated Widget, to which the message is transferred:

  8. The Widget adds the product to the basket in the Merchant's store (iziAddToCart).

  9. Upon receiving the request PUT/v1/izi/basket/{basket_id}, InPost Pay updates the existing basket when basket_linked=true, or binds it to the phone number assigned to the trusted browser when basket_linked=false. Then, it notifies the Merchant's backend of the successful operation (response 200).

  10. The Merchant's backend calls inpost-update-count that authorizes updating the number of products on the button.

  11. The widget presents the updated number of products in the basket.

  12. After obtaining the information that the basket is now linked, the Widget starts observing the Merchant's backend (with the use of iziGetOrderComplete and one of the looping or websocket methods), to see if the order was completed for the basket.

Link to calling the method: PUT/v1/izi/basket/{basket_id} as an example

Basket synchronization initiated by InPost Pay:

  1. In the InPost Pay app, the Customer will be able to update the basket in the scope of:

    1. changing the quantity of the products in the basket (quantity_event_data)

    2. adding/removing a promotion code (promo_codes_event_data)

    3. adding a suggested product to the basket (related_products_event_data)

  2. In the event when the user performs one of the aforementioned modifications in the basket, InPost Pay, using the method POST/v1/izi/basket/{basket_id}/event, will notify the Merchant in the form of an event of the specific operation.

  3. The Merchant's backend recalculates the basket.

  4. Upon receiving the event which updates the customer's basket, the Merchant's backend sends the updated basket in the response POST/v1/izi/basket/{basket_id}/event.

  5. The Merchant's backend calls inpost-update-count that authorizes updating the number of products on the button.

  6. The Merchant's backend notifies the store's frontend, which shows the updated basket to the customer.

  7. The widget presents:

  8. The InPost Pay app presents the updated basket.

Link to calling the method: POST/v1/izi/basket/{basket_is}/event

Order synchronization initiated on the Merchant's store website:

  1. When the Merchant has:

    1. changed the status of the order, or the description of the order status presented in the store

    2. assigned a reference number to the shipment they should call the method POST/v1/izi/order/{order_id}/event to the InPost Pay app in order to update the order's data.

  2. Upon receiving the request POST/v1/izi/order/{order_id}/event, InPost Pay updates the order, and returns the confirmation of the successful operation (response 200).

Link to calling the method: POST/v1/izi/order/{order_id/event as an example

Order synchronization initiated by InPost Pay:

  1. If the customer has:

    1. paid for the order, or

    2. rejected the order before the payment
      InPost notifies the Merchant of the occurrence of the event with the use of the method from POST/v1/izi/order/{order_id}/event.

  2. Upon receiving the request POST/v1/izi/order/{order_id}/event, the Merchant returns the confirmation of receiving the information (response 200).

Link to calling the method: POST/v1/izi/order/{order_id}/event as an example

Diagram UC.04 Synchronization of the basket and the order