Skip to content

Instantly share code, notes, and snippets.

@alphaolomi
Last active February 1, 2024 15:04
Show Gist options
  • Save alphaolomi/2a7a522fb6a429cdbd49c6324e74c22b to your computer and use it in GitHub Desktop.
Save alphaolomi/2a7a522fb6a429cdbd49c6324e74c22b to your computer and use it in GitHub Desktop.

Revisions

  1. alphaolomi renamed this gist Feb 1, 2024. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. alphaolomi revised this gist Aug 21, 2023. 1 changed file with 56 additions and 0 deletions.
    56 changes: 56 additions & 0 deletions diagram2.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,56 @@
    ## Diagram 2

    ```mermaid
    sequenceDiagram
    actor Buyer as Buyer (A User using Online Payments)
    participant eCommercePlatform as eCommerce Platform
    participant PSP as Payment Service Provider
    participant MNO as Mobile Network Operator
    activate Buyer
    Buyer->>eCommercePlatform: Clicks Pay on Checkout page
    activate eCommercePlatform
    eCommercePlatform->>PSP: Calls API for payment
    activate PSP
    PSP->>MNO: Calls API for payment
    activate MNO
    MNO->>MNO: Requests user to enter PIN using USSD STK Push
    MNO-->>Buyer: USSD prompt to enter PIN
    activate Buyer
    opt Valid PIN entered
    Buyer->>MNO: Enters valid PIN
    MNO->>MNO: Processes PIN
    MNO->>PSP: Sends webhook with transaction status (PIN verified)
    end
    opt Wrong PIN entered
    Buyer->>MNO: Enters wrong PIN
    MNO->>MNO: Processes wrong PIN
    MNO->>PSP: Sends webhook with transaction status (PIN verification failed)
    end
    opt USSD Timeout
    MNO->>MNO: USSD prompt timeout
    MNO->>PSP: Sends webhook with transaction status (timeout)
    end
    deactivate Buyer
    deactivate MNO
    PSP->>eCommercePlatform: Sends webhook with transaction status (PIN verification result)
    deactivate PSP
    eCommercePlatform-->>Buyer: Shows Transaction status message
    deactivate eCommercePlatform
    activate Buyer
    Buyer->>eCommercePlatform: Initiates query transaction request
    activate eCommercePlatform
    eCommercePlatform->>PSP: Sends query transaction request
    activate PSP
    PSP-->>eCommercePlatform: Responds with latest transaction status
    deactivate PSP
    deactivate eCommercePlatform
    deactivate Buyer
    ```
  3. alphaolomi created this gist Aug 21, 2023.
    61 changes: 61 additions & 0 deletions mobile-money.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,61 @@
    Draw a sequence diagram to demonstrate how Mobile Money with USSD STK Push works


    ## Notes

    A C2B transaction between A Buyer to a Business

    ## Actors
    - Buyer (A User using Online Payments)
    - eCommerce Platform
    - PSP (Payment Service Provider)
    - MNO (Mobile Network Operator)

    1. A Buyer initiates the payment process (eg clicking Pay on Checkout page)

    2. eCommercePlatform calls API to PSP

    3. PSP call API to MNO

    4. MNO requests User in enter pin using USSD STK Push,

    4.1 User can enter valid PIN
    4.2 User can enter wrong PIN
    4.3 USSD Prompt can timeout as user delay/fail to enter

    5. MNO sends webhook to PSP with latest status of transaction

    6. PSP sends webhook to eCommerce Platform

    7. eCommerce Platform shows Transaction status message



    ```mermaid
    sequenceDiagram
    actor Buyer as Buyer (A User using Online Payments)
    participant eCommercePlatform as eCommerce Platform
    participant PSP as Payment Service Provider
    participant MNO as Mobile Network Operator
    Buyer->>eCommercePlatform: Clicks Pay on Checkout page
    eCommercePlatform->>PSP: Calls API for payment
    PSP->>MNO: Calls API for payment
    MNO->>MNO: Requests user to enter PIN using USSD STK Push
    MNO-->>Buyer: USSD prompt to enter PIN
    alt Valid PIN entered
    Buyer->>MNO: Enters valid PIN
    MNO->>MNO: Processes PIN
    MNO->>PSP: Sends webhook with transaction status
    else Wrong PIN entered
    Buyer->>MNO: Enters wrong PIN
    MNO->>MNO: Processes wrong PIN
    MNO->>PSP: Sends webhook with transaction status (failed)
    else USSD Timeout
    MNO->>MNO: USSD prompt timeout
    MNO->>PSP: Sends webhook with transaction status (timeout)
    end
    PSP->>eCommercePlatform: Sends webhook with transaction status
    eCommercePlatform-->>Buyer: Shows Transaction status message
    ```