Checkout Basics
The checkout process allows to identify a customer and obtain the benefits in their wallet to apply to an specific purchase.
This is done via 3 main steps: Create, Total and Commit.
Create a session
The customers must identify themselves to redeem their services (promotions, coupons, balance available in saving programs, use Gift Card as a payment method, etc.).
In the physical or brick and mortar stores, at any time after starting the operation and before doing the TOTAL, the POS must read the QR code (or identify via any of the supported methods) of the customer and call the following method:
/api/CheckoutSessionAs a response, you will receive a "CheckoutSession" object with the information about the identified customer and a unique session id that identifies this transaction with Wapping and will be used in the following calls.
All the responses of the Create, Total and Commit methods carry the same object, in the recipes they might be partially shown to reflect the important fields.
Totalization
When all the item lines are added to the order, it must be totalized. Wapping will inform about the promotions, coupons, gift cards, etc. that are being applied in the order. To totalize an order, the following method is used, specifying the sessionId obtained in the first call:
/api/CheckoutSession/sessionId/totalAs a result of this call, the response provides which items discounts must be applied, what benefits have been obtained for this purchase, promotions applied, savings programs, points obtained, how much has been paid with a gift card, etc. and reports the balances remaining to be paid with the standard payment methods supported by the business.
Note that all the information related to the applied Wapping services will be contained within the CheckoutSession object, in CheckoutSession.Details.
The first thing to consider is that within the CheckoutSession.Details object we will have the field ActionToDo, which is an enumeration from 1 to 4. This will indicate the following:
- Case 1: Only report, this informs us that it is a service that we only need to inform the customer about. Such as the activation of a gift card, the accumulation of points in the savings program, etc.
- Case 2: Discount order line, in this case, we are informed that it is a discount at the order line level.
- Case 3: Discount order, now, it informs us that the discount is applied to the total ticket.
- Case 4: Payment to order, this last case informs us that it is a discount applied as a form of payment
Commit
If everything went well, the order is confirmed by calling the following method:
/api/CheckoutSession/sessionId/commitThis call performs the confirmation of all benefits obtained and redeemed in the last Total call.
In orther to do this, it will only be necessary to send to Wapping the confirmation date, the order code, and the payment methods used for the order that are external to Wapping (Cash, card, checks, etc.).
It is important to commit the order as while the order is not confirmed it remains pending of confirmation and, if after 20 minutes (by default) from the start of the session, an automatic cancel is made.
This is a securit mechanism to avoid fraud, as the platform performs a pre-autorization of the services avoiding to be used in concurrent checkouts.
Remember that all the sessions have to be commited or cancelled, do not rely on the autocancel as this is a last-resort mechanism, this must be handled in the integration.
