Loops HouseClinicPay

NEAR HACKATHON
Links
Team
1 member- AMOwner
Aman Kumar Sah
Overview
ClinicPay fixes a problem every private clinic has: one bill, several payers. A patient can pay an open share from any chain through NEAR Intents (1Click): they send what they hold, and the clinic receives exactly the share in USDC on NEAR in the same flow. An invoice is split into shares (the insurer's portion, the patient's co-pay, an employer scheme), each naming who owes it, priced in NEAR or any NEP-141 stablecoin such as USDC. The insurer adjudicates its share on chain before paying: it approves all, part (with a reason code such as CO-45) or nothing, and the unapproved part moves to the patient's share, so the bill still balances and the clinic is still paid in full; the decision is signed, final and emitted as an event. Patients pay stablecoin shares without holding NEAR: they sign a NEP-366 delegate action and the ClinicPay relayer pays the gas, but only for ClinicPay calls whose share it has checked on chain. Testing caught that NEP-366 makes the relayer fund attached deposits, so NEAR-priced shares are never relayed. Each payment is forwarded to the clinic in the same transaction (the contract never holds funds), writes a NEP-297 receipt, and is rolled back with the payer refunded if forwarding fails. The clinic can refund a share to whoever paid it. A clinic dashboard reads every invoice from chain (billed, collected, outstanding, who owes what, each insurer decision) with a one-click accountant CSV, and an NHS cost benchmark checks line items before billing. Verified by 99 tests (41 unit, 23 on a local NEAR node with real wasm and balances, 35 JS): a gasless payment moves the patient's NEAR by exactly 0, and an Intents-style delivery (sandbox stand-in) settles at the verifier's 30 Tgas minimum or rolls back. A live 1Click quote prices exactly 10 USDC delivered on NEAR; real-money cross-chain runs are not yet claimed. It is live on NEAR testnet (clinicpay-demo-mwgv5r7s.testnet) with a paid split invoice.