More screenshots
Works with the AI Agents you already use
ZainCash Integration Check
Catch ZainCash payment mistakes before real money moves: redirect and webhook tokens trusted without a signature check, leaked client secrets and API keys, wrong currency, decimal dinars, and unchecked refunds.
$5
ZainCash Integration Check
Example session with this skill installed
Check the ZainCash code in examples/vulnerable before we go live.
- Read your context and instructions
- Compiled the zaincash integration check
Summary
I ran python3 scripts/check_zaincash.py examples/vulnerable on the sample files that ship with this skill. Verdict:
BLOCK (exit code 2), with 5 BLOCK and 7 REVIEW findings in 7 files.
| Level | File | Rule |
|---|---|---|
| BLOCK | app/lib/zaincash.dart:2 | Z03 token request in the Flutter app |
| BLOCK | server/config.js:4 | Z01 client secret in code |
| BLOCK | server/init.js:8 | Z05 currency USD instead of IQD |
| BLOCK | server/redirect.js:5 | Z04 jwt.decode without a signature check |
| BLOCK | web/checkout.ts:2 | Z02 secret in a NEXT_PUBLIC_ variable |
| REVIEW | server/config.js:3 | Z17 test environment URL in code |
| REVIEW | server/init.js:5 | Z12 fixed externalReferenceId |
| REVIEW | server/init.js:8 | Z14 toFixed(2) decimal dinars |
| REVIEW | server/init.js:12 | Z15 payment URL built by hand |
| REVIEW | server/refund.py:3 | Z13 refund status never checked |
| REVIEW | server/webhook.js:5 | Z11 jwt.verify without algorithms |
| REVIEW | server/webhook.js:5 | Z16 webhook ignores eventId |
Full scanner output
BLOCK app/lib/zaincash.dart:2 Z03 TOKEN_REQUEST_IN_CLIENT
final tokenUrl = Uri.parse('$base...');
Why: This file runs on the user's device (a Flutter app or a "use client" component) and requests a ZainCash access token or holds a ZainCash secret, so the credentials ship inside the app.
Safer: Call /oauth2/token and /transaction/init from your server, and send the app only the redirectUrl.
BLOCK server/config.js:4 Z01 SECRET_IN_CODE
clientSecret: "abcd...",
Why: A ZainCash client secret or API key is written in the code. Anyone who can read the code or its history can take payments or forge tokens as your merchant account.
Safer: Ask ZainCash for new credentials, and read them from a server-side environment variable or secret store.
BLOCK server/init.js:8 Z05 WRONG_CURRENCY
amount: { value: order.total.toFixed(2), currency: "USD" },
Why: ZainCash payments must use the currency IQD. Any other currency makes the payment request fail.
Safer: Set amount.currency to "IQD" and convert prices to Iraqi dinars first.
BLOCK server/redirect.js:5 Z04 TOKEN_NOT_VERIFIED
const payload = jwt.decode(req.query.token);
Why: This code reads the payment result from a ZainCash redirect or webhook token without checking the token's signature, so anyone can forge a token that says SUCCESS and get an order marked as paid.
Safer: Verify every token with your ZainCash API key and HS256 before reading it, for example jwt.verify(token, apiKey, { algorithms: ['HS256'] }).
BLOCK web/checkout.ts:2 Z02 SECRET_IN_PUBLIC_ENV
const zaincashSecret = process.env.NEXT_PUBLIC_ZAINCASH_CLIENT_SECRET;
Why: Variables with this prefix are built into the browser or app bundle, so anyone can read this ZainCash secret.
Safer: Remove the public prefix and use the secret only in server code.
REVIEW server/config.js:3 Z17 TEST_URL_IN_CODE
baseUrl: "https://pg-api-uat.zaincash.iq",
Why: The ZainCash test environment URL (pg-api-uat) is written in application code, so production can end up calling the test environment.
Safer: Read the base URL from configuration, with the production URL ZainCash gives you at onboarding.
REVIEW server/init.js:5 Z12 FIXED_REFERENCE_ID
externalReferenceId: "7655...",
Why: externalReferenceId is a fixed value. ZainCash uses it as the idempotency key of one payment attempt, so reusing it mixes up payments.
Safer: Create a new UUID for every payment attempt, for example crypto.randomUUID() or uuid.uuid4().
REVIEW server/init.js:8 Z14 DECIMAL_AMOUNT
amount: { value: order.total.toFixed(2), currency: "USD" },
Why: Iraqi dinar amounts are whole numbers. ZainCash rejects decimal refund and payout amounts, and a decimal from toFixed or parseFloat can change the price.
Safer: Send whole dinars, for example Math.round(total), and keep prices as integers.
REVIEW server/init.js:12 Z15 HANDMADE_REDIRECT_URL
return `${BASE_URL}/transaction/pay?id=${init.transactionDetails.transactionId}`;
Why: The payment page URL is built by hand. ZainCash's docs say to always use the redirectUrl returned by transaction/init.
Safer: Redirect the customer to the redirectUrl field of the init response.
REVIEW server/refund.py:3 Z13 REFUND_STATUS_UNCHECKED
response = post(BASE_URL + "/api...",
Why: ZainCash refunds return HTTP 200 even when they fail, with status "FAILED". This code never checks for FAILED or COMPLETED, so a failed refund can look like a success.
Safer: Read the status field of every refund response and handle FAILED; store the reversalReferenceId.
REVIEW server/webhook.js:5 Z11 ALGORITHM_NOT_PINNED
const payload = jwt.verify(req.body.webhook_token, config.zaincashApiKey);
Why: jwt.verify is called without an algorithms option, so the library accepts whatever algorithm the token's header names.
Safer: Pass { algorithms: ['HS256'] }, the algorithm ZainCash signs with.
REVIEW server/webhook.js:5 Z16 WEBHOOK_NOT_IDEMPOTENT
const payload = jwt.verify(req.body.webhook_token, config.zaincashApiKey);
Why: This webhook handler never looks at eventId. ZainCash may send the same event more than once, so an order can be processed twice.
Safer: Store each eventId you handle; when it repeats, skip the work and still return HTTP 200.
Verdict: BLOCK. Checked 7 files, 7 with ZainCash code.
This is a static check of source text. NOT FLAGGED is not a guarantee.
Next steps
Fix the BLOCK findings first: verify the redirect token with jwt.verify and HS256, move the secret and the token request to the server, ask ZainCash for new credentials, and send IQD. 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
ZainCash sends the payment result as a signed token. Code that reads that token without checking its signature lets anyone forge a "SUCCESS" and get an order marked as paid. This skill finds that mistake and eleven others in your ZainCash Payment Gateway v2 integration, 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, with the file, line, reason, and a safer approach for every finding.
It also includes a token helper: give it the redirect URL or webhook body you received and a file holding your API key, and it checks the HS256 signature and shows the status, order, transaction, and amount inside the token.
What it checks
BLOCK
- Z01: a client secret or API key written in code
- Z02: a ZainCash secret in a public env variable (
NEXT_PUBLIC_,VITE_, and similar) - Z03: a token request or secret in Flutter or
"use client"code - Z04: a redirect or webhook token read without a signature check
- Z05: a currency other than IQD
REVIEW
- Z11:
jwt.verifycalled without analgorithmsoption - Z12: a fixed
externalReferenceId - Z13: a refund whose FAILED status is never checked (ZainCash returns HTTP 200 for failed refunds)
- Z14: a decimal dinar amount
- Z15: a payment URL built by hand instead of
redirectUrl - Z16: a webhook that ignores
eventId - Z17: the test environment URL left in application code
What's included
- The scanner and the token helper (Python 3.9+, standard library only)
- A guide to the safe v2 flow, with token verification examples for Node, Python, and PHP
- 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 ZainCash, 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. Java and C# files are not scanned. The rules follow ZainCash's v2 documentation as updated on 11 Aug 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 Security.
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. Java, C#, Vue, and Svelte files are not scanned. The rules follow ZainCash v2 documentation as updated on 11 Aug 2026.
How to use
- 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
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 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
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.