Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Rule 1 - First Order Physical Payment Limit

For the first order with a value >= X €For a user's first order, if the total value is equal to or exceeds €20, only online payment methods will be allowed, where X is configurablepermitted. The initial intention is to set it to 20 €.

Questions:

  • How can we identify the first order of a user? Is there any mechanism in place?

Solution

We can get advantage of gateway query getUserOrders, this query returns all orders from the logged user with a count. We query this when the browser loads the payment method screen. This is the response:

image-20240318-222827.pngImage Removed

New user without any order.

When this count is 0, we don’t show Physical Paymentsthreshold value of €20 is configurable and can be adjusted as needed.

Identification of First Orders:

We can determine whether an order is a user's first by utilizing the getUserOrders gateway query. This query retrieves all orders associated with the currently logged-in user and includes a count of these orders. Here is the process:

  1. Trigger the getUserOrders when the payment method screen loads.

  2. The response includes all past orders of the user and a count of these orders.

    1. Sample response of a user without any previous orders:

      Code Block
      languagejson
      {
      "data": {
        "userOrders": {
          "count": 0,
          "resumeAfter": null,
          "orders": [],
          "__typename": "OrderListResponse"
        }
      }
  3. If the count is 0, indicating no previous orders, physical payment options should not be displayed.

This new rules ensures that users attempting their first purchase with a total of €20 or more are only presented with online payment options.