More screenshots

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Paymob Integration Check

    0

    Catch Paymob integration mistakes before real payments: leaked secret keys, callbacks trusted without an HMAC check, the wrong HMAC fields, and amounts that are not whole cents.

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Paymob Integration Check

    Paymob Integration Check

    Example session with this skill installed

    Check the Paymob code in examples/vulnerable before we go live.

    • Read your context and instructions
    • Compiled the paymob integration check

    Summary

    I ran python3 scripts/check_paymob.py examples/vulnerable on the sample files that ship with this skill. Verdict:

    BLOCK (exit code 2), with 5 BLOCK and 5 REVIEW findings in 9 files.

    LevelFileRule
    BLOCKapp/lib/payment.dart:2P03 secret used in Flutter code
    BLOCKserver/callback.js:4P04 callback handled without an HMAC check
    BLOCKserver/config.js:2P01 live secret key in code
    BLOCKserver/hmac_sha256.js:9P05 HMAC built with SHA-256
    BLOCKweb/checkout.ts:2P02 secret in a NEXT_PUBLIC_ variable
    REVIEWserver/hmac_compare.py:13R02 plain == compare
    REVIEWserver/hmac_spelling.php:3R03 error_occurred spelling
    REVIEWserver/hmac_spelling.php:9R04 HMAC fields incomplete
    REVIEWserver/intention.js:3R05 cart.total * 100 not rounded
    REVIEWserver/sandbox.py:2R01 test secret key in code

    Full scanner output

    BLOCK   app/lib/payment.dart:2  P03 SECRET_IN_CLIENT_CODE
        const paymobSecret = String.fromEnvironment('PAYMOB_SECRET_KEY');
        Why: This file runs on the user's device (a Flutter app or a "use client" component), so a Paymob secret used here can be extracted.
        Safer: Create the payment intention on your server and return only the public key and the client_secret to the app.
    
    BLOCK   server/callback.js:4  P04 CALLBACK_WITHOUT_HMAC
        if (obj.success) {
        Why: This code reads a Paymob callback's result but never checks its HMAC, so anyone who sends a fake request can mark an order as paid.
        Safer: Recompute the HMAC-SHA512 of the callback fields with your HMAC secret and compare it, in constant time, with the hmac query parameter before you trust any field.
    
    BLOCK   server/config.js:2  P01 LIVE_SECRET_KEY_IN_CODE
        export const paymobSecretKey = "egy_sk_live_...";
        Why: A live Paymob secret key is written in source code. Anyone who can read the code or its history can call the Paymob API as your account.
        Safer: Revoke this key in the Paymob dashboard, create a new one, and read it from a server-side environment variable or secret store.
    
    BLOCK   server/hmac_sha256.js:9  P05 WRONG_HMAC_ALGORITHM
        const expected = crypto.createHmac("sha256", secret).update(message).digest("hex");
        Why: Paymob signs callbacks with HMAC-SHA512. An HMAC built with another algorithm never matches, so real payments fail or the check gets removed.
        Safer: Use HMAC-SHA512 with your Paymob HMAC secret.
    
    BLOCK   web/checkout.ts:2  P02 SECRET_IN_PUBLIC_ENV
        const paymobSecret = process.env.NEXT_PUBLIC_PAYMOB_SECRET_KEY;
        Why: Variables with this prefix are built into the browser or app bundle, so anyone can read this Paymob secret.
        Safer: Remove the public prefix, use the value only in server code, and send the browser only the public key and the client_secret.
    
    REVIEW  server/hmac_compare.py:13  R02 NON_CONSTANT_TIME_COMPARE
        return expected == received_hmac
        Why: The HMAC is compared with an ordinary equality check, which can leak how many characters matched through response timing.
        Safer: Compare with crypto.timingSafeEqual (Node), hmac.compare_digest (Python), or hash_equals (PHP).
    
    REVIEW  server/hmac_spelling.php:3  R03 HMAC_FIELD_MISSPELLED
        $keys = ['amount_cents', 'created_at', 'currency', 'error_occurred', 'has_parent_transaction',
        Why: Paymob spells this callback key error_occured (one r). Using error_occurred reads an empty value, so the HMAC never matches.
        Safer: Read the value from error_occured, exactly as Paymob spells it.
    
    REVIEW  server/hmac_spelling.php:9  R04 HMAC_FIELDS_INCOMPLETE
        $expected = hash_hmac('sha512', $message, $secret);
        Why: Paymob's transaction HMAC covers 20 fields in a fixed order. This code names some of them but not all, so the HMAC will not match. Missing: error_occured.
        Safer: Concatenate all 20 fields in Paymob's documented order before hashing.
    
    REVIEW  server/intention.js:3  R05 AMOUNT_NOT_WHOLE_CENTS
        amount: cart.total * 100,
        Why: Paymob takes amounts as a whole number of cents. In floating point, 19.99 * 100 is 1998.9999999999998, and int(), intval, parseInt, floor and trunc cut that to 1998 instead of 1999.
        Safer: Round to the nearest cent with Math.round (JavaScript), round() (Python), or (int) round() (PHP), or keep prices in integer cents from the start.
    
    REVIEW  server/sandbox.py:2  R01 TEST_SECRET_KEY_IN_CODE
        PAYMOB_SECRET_KEY = "egy_sk_test_..."
        Why: A Paymob test secret key is written in source code. It cannot move real money, but keys in code tend to be swapped for live ones later.
        Safer: Read the key from a server-side environment variable and keep it out of the repository.
    
    Verdict: BLOCK. Checked 9 files, 9 with Paymob code.
    This is a static check of source text. NOT FLAGGED is not a guarantee.
    

    Next steps

    Fix the BLOCK findings first: revoke the live key and read it from the server's environment, remove the secret from the Flutter app and the public variable, and add an HMAC-SHA512 check to the callback. Then run the check again. The fixed versions in examples/safe give NOT FLAGGED.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    A Paymob callback accepted without checking its HMAC lets anyone mark an order as paid. A secret key in a NEXT_PUBLIC_ variable ends up in every visitor's browser. This skill finds those mistakes in your code and tells you how to fix each one.

    Your agent runs a scanner on your project. It reads JavaScript, TypeScript, Python, PHP, and Dart files, plus .env files, and returns BLOCK, REVIEW, or NOT FLAGGED. Each finding shows the file and line, the reason, and a safer approach.

    It also includes a helper for the most common Paymob question: why doesn't my HMAC match? Give it the callback Paymob sent and a file holding your HMAC secret. It prints the 20 values Paymob signs, the joined string, and the HMAC-SHA512, and tells you whether it matches.

    What it checks

    BLOCK

    • P01: a live secret key written in code
    • P02: a Paymob secret in a public env variable (NEXT_PUBLIC_, VITE_, REACT_APP_, EXPO_PUBLIC_, and similar)
    • P03: a secret used in client code (Flutter, or a "use client" file)
    • P04: a callback handled without an HMAC check
    • P05: an HMAC built with an algorithm other than SHA-512

    REVIEW

    • R01: a test secret key written in code
    • R02: an HMAC compared without a constant-time compare
    • R03: error_occurred instead of Paymob's spelling, error_occured
    • R04: an HMAC built from only some of the 20 fields
    • R05: an amount that is not a whole number of cents, including int(), intval, parseInt, or floor used where rounding is needed

    What's included

    • The scanner and the HMAC helper (Python 3.9+, standard library only)
    • A guide to the safe Intention API flow, with HMAC code for Node and Python that was tested against the helper
    • Example vulnerable and fixed files, and the real report the scanner produces on them

    Limits

    It is a static check of source text. It does not run your code, call Paymob, or use the network. A check done in another file, or through a library it does not recognize, can cause a false finding or a miss, so NOT FLAGGED is not a guarantee. The HMAC field list follows Paymob's documentation as read in November 2026.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.

    Static check of source text only; it does not run code. A check done in another file, or through a library it does not recognize, can cause a false finding or a miss. Vue and Svelte files are not scanned. The HMAC field list follows Paymob documentation as read in November 2026.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 9 days ago

    Software
    python3 (3.9+)

    Permissions

    Terminal / Shell
    Read Files

    Runs two local Python scripts in the terminal. They read your project's files, write nothing, and make no network calls. The process.env lines in the examples are sample code for the scanner to find, not code that runs.

    Listed9 days ago
    Updated4 days ago

    What's inside

    Frequently Asked Questions

    No. The scripts read local files only and do not use the network. Reports mask secret keys and hide .env values.

    Only for the HMAC helper, and only as a file you create outside your repository. The helper never prints the secret.

    The callback and HMAC rules cover Paymob's transaction callbacks, which both the Intention API and the older Accept flow send. The guide describes the Intention API with Unified Checkout.

    New in APIs & Backend