# Payment Processing Flow

This diagram illustrates the sequence of transactions initiated on any platform, like an e-commerce website, and follows through to the final processing by the bank. The steps include:

### **1-Transaction Initiation**&#x20;

Starts from an external channel, like an e-commerce site.

### **2-Smart Router**&#x20;

Upon receiving a transaction, the Smart Router assesses various criteria to select the most suitable payment gateway (PG) based on pre-configured rules.

* ### Recommended Routing Process:

1. **Database of MIDs**: Repository where Merchant Identification Numbers (MIDs) are stored for transaction processing.
2. **Strategy (1)** [**Multi-Selection**](#multiple-selection-strategy-inclusive-strategy): Allows selecting multiple MIDs simultaneously for efficiency.
3. **Strategy (2)** [**Single**](#single-selection-strategy-exclusive-strategy)**/**[**Multiple Selection**](#multiple-selection-strategy-inclusive-strategy): Selection of either one or multiple MIDs. Depending on the choice:
   * Multiple MIDs lead to a repeated selection process.
   * A single MID moves directly to the final step (6).
4. **Repetition of** [**Multiple Selection**](#multiple-selection-strategy-inclusive-strategy) **Process (n-1) Times**: If multiple MIDs are selected, this iterative process repeatedly refines the choices. Each iteration assesses the MIDs against the configured [Strategy](#strategies), narrowing down the selection.
5. **Strategy (n)** [**Single Selection**](#single-selection-strategy-exclusive-strategy): Finalizes the selection to one MID, ensuring it fits the transaction requirement.
6. **Pass the Selected MID**: The chosen MID is forwarded to the transaction processing system to complete the transaction.

<figure><img src="https://documents.lucid.app/documents/800b2bbd-2d5a-4271-bf73-a57f965a5bad/pages/jXdvN~MA9KNi?a=1566&#x26;x=638&#x26;y=-1287&#x26;w=564&#x26;h=1370&#x26;store=1&#x26;accept=image%2F*&#x26;auth=LCA%20ad7c8754553c3ddbf3b0fd86780b7ff49f09d7ff2b5dc3888650c2b0f9aeb3f7-ts%3D1713786663" alt="" width="375"><figcaption></figcaption></figure>

### **3-Payment Gateway**

The Smart Router directs the transaction to the chosen PG.

### **4-Bank Processing**

The selected PG then processes the payment by forwarding it to the associated bank.

<figure><img src="https://documents.lucid.app/documents/800b2bbd-2d5a-4271-bf73-a57f965a5bad/pages/rap5juHOACzn?a=1699&#x26;x=-5858&#x26;y=-998&#x26;w=6104&#x26;h=499&#x26;store=1&#x26;accept=image%2F*&#x26;auth=LCA%203a6c60917066ecd42bf01e6e052e023cde21d59523398b39451deaa79d643aac-ts%3D1713786663" alt=""><figcaption></figcaption></figure>
