Sample code
Complete samples in five languages. Each includes:
- request encryption and all 12 endpoints;
- receiving and verifying callbacks (decrypt → check merchant number → deduplicate → verify state and amount with Get order);
- a command-line demo;
- self-tests that don't touch the platform (a local mock platform);
- only the language's standard library (plus
cryptographyfor Python) — no other third-party dependencies.
Keys are always read from environment variables or files; the samples contain no keys.
Downloads
| Language | Download | SHA256 |
|---|---|---|
| Node.js | ibitpay-openapi-nodejs.zip (12.5 KB) | b11b827ea2b12bb1eb0bce39898f4e7d2184895d5e249ea8a1a72abdc9b24c59 |
| Python | ibitpay-openapi-python.zip (11.3 KB) | 19177186fd8f956bd0b7281c3a680a49789aed86a8cc6a5c186e855daa05ab91 |
| PHP | ibitpay-openapi-php.zip (11.5 KB) | 81de4476eae49a75053813571ce598f67f1b7888450a603f8cf3914f02bcc025 |
| Java | ibitpay-openapi-java.zip (18.3 KB) | 3e7a09545efa6b45fba0c79091f5797f94703095308035acbd006f0b4ee939a0 |
| C# | ibitpay-openapi-csharp.zip (13.5 KB) | b88c102b001931f0380a9ed78229f0492fbf11127cf6708cfa11bd331b9b0e3e |
Verify the SHA256 after downloading to make sure the file is complete and unmodified:
# macOS / Linux
shasum -a 256 ibitpay-openapi-nodejs.zip
# Windows PowerShell
Get-FileHash ibitpay-openapi-nodejs.zip -Algorithm SHA256All checksums are also in SHA256SUMS.txt.
Requirements
| Language | Version | Notes |
|---|---|---|
| Node.js | 20+ | No dependencies; npm test |
| Python | 3.9+ | pip install -r requirements.txt; python -m unittest |
| PHP | 8.1+ | openssl and curl extensions; php tests/run.php |
| Java | 17+ | JDK only; uses a tiny bundled JSON helper you can swap for Jackson |
| C# | .NET 8+ | Framework classes only |
Quick start
In the merchant console under Developers → API & callbacks, find the API base URL and save the public and private key to two files outside your code directory, readable only by the account that runs the program.
Set environment variables:
bashexport IBITPAY_BASE_URL=the-API-base-URL-shown-in-the-merchant-console export IBITPAY_MERCHANT_NO=your-merchant-number export IBITPAY_PUBLIC_KEY_FILE=/secure/dir/ibitpay_public.pem export IBITPAY_PRIVATE_KEY_FILE=/secure/dir/ibitpay_private.pem # only needed by the callback serviceRun the self-tests, then the demo (e.g.
node demo.js balance), then wire up the callback service as described in the README.
Each package's README (in Chinese) has language-specific details and a payout example.
Old sample
The DemoMerchant.zip offered by the previous documentation is no longer maintained. Its callback handler credited orders straight from the callback content without verifying them, which allows forged callbacks. Please use the samples above.