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.

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

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

  2. PSP sends webhook to eCommerce Platform

  3. eCommerce Platform shows Transaction status message

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

Loading

Diagram 2

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
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment