Checkout Controller
Checkout Controller Documentation
Overview
The Checkout Controller manages the financial transactions by tokenizing card data, initiating sales, and processing final sale confirmations.
Functions
-
tokenizeCard: Isolates the card tokenization process. It sends card data to the tokenization endpoint and returns a token representing the card (facToken).
-
checkout: Manages the checkout process. It tokenizes user’s card data, updates the user’s
facToken, then sends a sale request to the PowerTrans endpoint, extractsRedirectDatafrom the response and sends it to the frontend, which is then rendered in an iframe to trigger the 3D Secure process and then the process Sale endpoint. -
processSale: Completes the transaction. It extracts the
SpiTokenfrom the request body and sends it to the process sale endpoint. Depending on the response, it sends back a success or error message to the client.
Process Flow
- Tokenization: User’s card data is securely tokenized and stored as
facTokenin the user’s record. - Sale Request: A sale request is made using the
facToken, and the response’sRedirectDatais passed to the frontend. - Finalizing Sale: The
processSalefunction uses theSpiTokento finalize the transaction, sending back a transaction status to the frontend.
Importance
This controller is critical for securely handling sensitive payment information and ensuring that transactions are processed accurately and efficiently, providing a secure and user-friendly payment experience.