iranian-payment-gateways
Skill1 starsChanged 18 days agoMITView on GitHub
Integrate Zarinpal and other Shaparak redirect gateways with a server-side verify call, Rial and Toman amounts, and one paid transition per authority. Use when adding an Iranian payment gateway or fixing callback, verify, or amount handling for IRR or IRT stores.
In this repository28 other files it gives its agents.
- b2b-pricingSkill
- catalog-import-and-migrationSkill
- checkout-ux-and-conversionSkill
- conversion-event-trackingSkill
- ecommerce-seo-structured-dataSkill
- fraud-and-risk-basicsSkill
- google-merchant-product-feedsSkill
- headless-nextjs-storefrontSkill
- inventory-and-multi-warehouseSkill
- marketplace-search-and-rankingSkill
- mcp-store-toolingSkill
- multi-vendor-payoutsSkill
- order-and-webhook-reliabilitySkill
- payment-gateway-integrationSkill
- product-catalog-modelingSkill
- product-description-guardrailsSkill
- returns-and-refundsSkill
- rtl-and-persian-localizationSkill
- shopify-app-developmentSkill
- storefront-accessibilitySkill
- storefront-performanceSkill
- stripe-paymentsSkill
- subscription-billingSkill
- tax-and-shippingSkill
- vector-product-searchSkill
- woocommerce-plugin-developmentSkill
- woocommerce-rest-apiSkill
- wordpress-plugin-securitySkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Create the shop order first, unpaid, with the total in the store currency.
- Very specific: line 22
If Status is OK, call verify from the server with the same amount and authority.
- Very specific: line 33
Run node scripts/check-verify.mjs order.json verify.json to see what a stored order and a verify response mean together.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Iranian payment gateways
Iranian card payments run through Shaparak, the national card switch, behind a payment facilitator or bank gateway such as Zarinpal. They share one flow: request a token, redirect the shopper, receive a callback, and verify on the server. Zarinpal request and verify fields are in the Zarinpal notes. The general rules in the payment gateway skill still apply.
Procedure
- Create the shop order first, unpaid, with the total in the store currency.
- Convert the total to the unit the gateway expects. Zarinpal accepts
currencyIRR(Rial) orIRT(Toman). Bank gateways usually take Rial only. One Toman is ten Rial. - Send the request call from the server with
merchant_id,amount,callback_url,description, and the order id inmetadata. Store the returnedauthorityon the order before redirecting. - Redirect to the gateway's start page, for Zarinpal
https://payment.zarinpal.com/pg/StartPay/{authority}. - On the callback, look up the order by
Authority. IfStatusisNOK, the payment failed or was canceled: keep the order unpaid. - If
StatusisOK, call verify from the server with the sameamountandauthority. The callback query is not proof of payment. - Mark the order paid only when verify returns success, and store
ref_id, the maskedcard_pan, and the gateway fee.
Verify results
Verify code | Meaning | Shop effect |
100 | Verified now | Mark paid once. Show ref_id to the shopper. |
101 | Already verified earlier | Paid. Do not send a second receipt or reduce stock again. |
| Any other code | Not verified | Leave unpaid and show the gateway message. |
Run node scripts/check-verify.mjs order.json verify.json to see what a stored order and a verify response mean together. It flags a mismatched amount, a mismatched authority, and the codes above.
Amounts and currency
- Store
IRRorIRTon the order and convert in one function. A store priced in Toman that sends Toman to a Rial-only gateway charges a tenth of the price. - Amounts are whole numbers. Reject a fractional amount instead of rounding it silently.
- Send the same
amountand unit in request and verify. Verify fails when they differ. - Show prices in the store's unit with Persian digits if the storefront is Persian, but keep Latin digits in API calls.
Unverified payments
If the shopper pays but your server never verifies (a closed tab, a timeout, a crash), Shaparak gateways return the money to the payer after a window the provider sets. Run a job that lists unverified authorities for recent unpaid orders and verifies them, so a paid shopper is not refunded by mistake. Zarinpal offers an unverified transactions call for this.
Gotchas
- Verifying in the browser exposes
merchant_idand lets a shopper fake success. Verify only from the server. - The callback URL can be opened twice: on a refresh, or by the shopper going back. The second verify returns
101, so treat it as already paid, not as an error. - Matching the callback by order id in the query string lets a shopper swap orders. Match by
Authorityfrom your own record. - Some gateways reject callback URLs on a different domain from the registered site. Register the exact domain.
- Gateways often need an Iranian server IP or a whitelisted IP for API calls. A timeout from abroad is not a declined payment.
Verification
- A callback with
Status=NOKleaves the order unpaid and does not call verify. - A callback with
Status=OKbut a verify code other than100or101leaves the order unpaid. - Opening the callback URL twice sends one receipt.
- A Toman store sends
currency: "IRT"to Zarinpal, or ten times the amount in Rial to a Rial-only gateway. - An order paid without a callback is found and verified by the reconciliation job.
Evaluation
Worked examples and the checks they must satisfy are in evals/tasks.json.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

