===================================================================== allfreecalculators.in - Cashfree Payment Setup (Hindi) ===================================================================== Payments poori tarah Cloudflare Worker par chalte hain (UPI, cards, net-banking, wallets - sab Cashfree hosted checkout se). PHP/Java ki zaroorat NAHI. --------------------------------------------------------------------- 1) Cashfree account --------------------------------------------------------------------- - merchant.cashfree.com par account banao (India). - Developers -> API Keys se milega: App ID (x-client-id) Secret Key (x-client-secret) - Test ke liye "Sandbox" keys, live ke liye "Production" keys. --------------------------------------------------------------------- 2) Cloudflare par keys set karo (secrets - safe) --------------------------------------------------------------------- Project folder me terminal: npx wrangler kv namespace create MT_KV -> jo id mile use wrangler.toml me PASTE_KV_ID_HERE ki jagah daalo npx wrangler secret put CASHFREE_APP_ID npx wrangler secret put CASHFREE_SECRET npx wrangler secret put ADMIN_TOKEN (koi bhi strong password - plan admin ke liye) wrangler.toml me CASHFREE_MODE: "sandbox" = test "production" = live Phir: npx wrangler deploy --------------------------------------------------------------------- 3) Cashfree webhook (payment confirm) --------------------------------------------------------------------- Cashfree dashboard -> Developers -> Webhooks -> Add: URL: https:///api/pay/webhook Events: Payment Success / Failed Signature apne aap verify hoti hai (HMAC-SHA256) - kuch aur nahi karna. --------------------------------------------------------------------- 4) Plans manage karna (admin panel) --------------------------------------------------------------------- - Kholo: https:///pay-admin/ - ADMIN_TOKEN daalo -> Load plans -> edit -> Save. - Default plans: Pro Monthly (Rs.199), Pro Yearly (Rs.1999). - Naye plan add kar sakte ho (id, name, amount, period, features). --------------------------------------------------------------------- 5) Users ke liye --------------------------------------------------------------------- - Pricing page: https:///pricing/ - User name/email/phone bharke plan choose karta hai -> Cashfree checkout khulta hai (UPI/card/netbanking/wallet). - Success ke baad /pay-success/ par aata hai; webhook se uska "paid" status KV me save ho jata hai (paid:). - Login/registration ke liye Firebase pehle se laga hai (#admin ya site ke auth se). Paid status email se match hota hai. --------------------------------------------------------------------- NOTE --------------------------------------------------------------------- - Secret key kabhi client/HTML me mat daalo - sirf wrangler secret. - Pehle sandbox me test karo, phir production keys + mode badlo. - Main is code ko live test nahi kar saka (aapke Cashfree keys chahiye), isliye pehli baar sandbox me ek test payment zaroor karke dekh lena. ===================================================================== PHASE 3 - Extra gateways, coupons, invoices, subscriptions ===================================================================== Ab Cashfree ke alawa Razorpay, Stripe aur PayPal bhi support hain. Jo gateway ki keys aap set karoge, sirf wahi pricing page par dikhega. Kuch bhi set na ho to page "setup mode" dikhata hai. --- Naye secrets (jo chahiye wahi set karo) --- npx wrangler secret put RAZORPAY_KEY_ID npx wrangler secret put RAZORPAY_KEY_SECRET npx wrangler secret put RAZORPAY_WEBHOOK_SECRET (recommended) npx wrangler secret put STRIPE_SECRET_KEY npx wrangler secret put PAYPAL_CLIENT_ID npx wrangler secret put PAYPAL_SECRET wrangler.toml me PAYPAL_MODE = "sandbox" ya "production". --- KV zaroori hai (plans/coupons/invoices/subscriptions ke liye) --- npx wrangler kv namespace create MT_KV -> id ko wrangler.toml me PASTE_KV_ID_HERE ki jagah daalo. --- Webhooks --- Cashfree : https:///api/pay/webhook Razorpay : https:///api/pay/razorpay/webhook (event: payment.captured ; secret = RAZORPAY_WEBHOOK_SECRET) Stripe : return par /pay-success/?sid=... khud verify karta hai. PayPal : approve ke baad /pay-success/?pporder=... capture karta hai. --- Coupons --- /pay-admin/ -> Coupons -> Load -> edit JSON -> Save. Example: {"code":"SAVE20","type":"percent","value":20,"active":true, "maxUses":100,"used":0,"expires":"2026-12-31"} User pricing page par coupon code daal kar discount pa sakta hai. --- Invoices & Subscriptions --- Har successful payment par invoice ban jata hai (KV me invoice:) aur paid user paid: me save hota hai. /pay-admin/ me "Load subscriptions" aur "Load invoices" se dekho. Public status check: /api/pay/status?email= Public invoice: /api/pay/invoice?id= NOTE: /vishal4747/ control panel ab Worker par block NAHI hai (pehle 403 aa raha tha). /vishal4747-pro aur /vishal4747-enterprise still blocked hain.