# NihaoPay API Documentation > NihaoPay is a cross-border payment gateway (Alipay, WeChat Pay, UnionPay, PayPal). This file helps LLM agents integrate a merchant with the NihaoPay REST API. Full documentation as plain text: English https://docs.nihaopay.com/llms-full.txt, Chinese https://docs.nihaopay.com/llms-full-zh.txt. ## Core rules - Base endpoint: `https://api.nihaopay.com`; version namespace `/v1.2` (e.g. `https://api.nihaopay.com/v1.2/transactions`). HTTPS only; responses are JSON (except SecurePay, which returns a payment page). - Authentication: `Authorization: Bearer `. The token is found in the TMS (https://tms.nihaopay.com) under Settings -> Certificate. Never expose merchant ID, secret key or token in client-side code or logs. - `amount` is a positive integer in the currency's minor unit (USD 1050 = $10.50; JPY has no minor unit). `amount` and `rmb_amount` are mutually exclusive. - Supported currencies: USD, JPY, HKD, EUR, CAD, GBP, SGD, AUD. Refund currency must equal the original payment currency. - `vendor`: `alipay`, `wechatpay`, `unionpay`, `paypal`; `terminal`: `ONLINE` (PC) or `WAP` (mobile). - `callback_url` / `ipn_url` must be publicly reachable (no localhost or intranet). The IPN (asynchronous notification) is the source of truth for the final order status; always verify `verify_sign` before trusting it. - IPN `verify_sign`: remove `verify_sign` and null-valued keys, sort remaining keys, join as `key=value` with `&`, append `&` + MD5(Token), then MD5 the result. Online calculator: https://docs.nihaopay.com/tools/signature - Keep each `reference` unique per merchant order; use it for idempotency and reconciliation. - Do not guess parameters: read the relevant page below first. Never hardcode secrets; use test accounts from the Testing page before going live. ## Choose the integration flow - Hosted checkout redirect (PC / mobile browser / WeChat browser) -> SecurePay - WeChat QR on PC -> SecurePay "Generate a Payment QRcode" - Native app -> SecurePay "In-App Payment"; WeChat Mini-Program -> "WeChat Mini-Program Payment" - In-store with scanner -> Scan QRcode; in-store without scanner -> Show QRcode / Static QRcode - Recurring deduction -> Auto Debit - Refund, query, list/download transactions, exchange rate -> Manage - Split settlement -> Profit Sharing; cross-border declaration -> Customs; balance/withdrawal -> Account - CardPay (PCI-certified merchants only) is documented at https://docs.muskpay.io/ ## Docs (English) - [Introduction](https://docs.nihaopay.com/en/): endpoint, TMS, SDKs - [Version & Authentication](https://docs.nihaopay.com/en/api/version) - [API Rules](https://docs.nihaopay.com/en/api/apirule): payment modes, amount/currency, IPN and signature verification - [SecurePay](https://docs.nihaopay.com/en/api/securepay): standard SecurePay, QR code, In-App, Alipay A+, Mini-Program, PayPal ACDC - [In-Store Payment](https://docs.nihaopay.com/en/api/offline): scan / show / static QR code - [Auto Debit](https://docs.nihaopay.com/en/api/autodebit): contract signing, termination, query, deduction, notification - [Refund/Query/Others](https://docs.nihaopay.com/en/api/manage): refund, refund query, transaction lookup/list/download, exchange rate, billing file - [Profit Sharing](https://docs.nihaopay.com/en/api/sharing) - [Customs Declaration](https://docs.nihaopay.com/en/api/customs) - [Account / Withdrawal](https://docs.nihaopay.com/en/api/account) - [Testing](https://docs.nihaopay.com/en/api/testing): test cards and sandbox accounts - [Errors](https://docs.nihaopay.com/en/api/errors): error object and error list - [Changelog](https://docs.nihaopay.com/en/api/changelog) - [Signature Calculator](https://docs.nihaopay.com/tools/signature) ## 文档 (中文) - [简介](https://docs.nihaopay.com/zh/) - [版本与认证](https://docs.nihaopay.com/zh/api/version) - [API 规则](https://docs.nihaopay.com/zh/api/apirule) - [安全支付 SecurePay](https://docs.nihaopay.com/zh/api/securepay) - [线下支付](https://docs.nihaopay.com/zh/api/offline) - [自动扣款](https://docs.nihaopay.com/zh/api/autodebit) - [退款/查询/其他](https://docs.nihaopay.com/zh/api/manage) - [分账](https://docs.nihaopay.com/zh/api/sharing) - [报关](https://docs.nihaopay.com/zh/api/customs) - [账户/提现](https://docs.nihaopay.com/zh/api/account) - [测试](https://docs.nihaopay.com/zh/api/testing) - [错误码](https://docs.nihaopay.com/zh/api/errors) - [更新日志](https://docs.nihaopay.com/zh/api/changelog) - [签名工具](https://docs.nihaopay.com/tools/signature) ## Optional - [Transaction Management System (TMS)](https://tms.nihaopay.com): tokens, transactions, reports - [Sample code, SDKs, plugins](https://github.com/nihaopay?tab=repositories) - Technical support: tech_support@nihaopay.com