Code Samples
The 6 samples below are all tested and include:
- HMAC signature generation
- HTTP call wrappers
- Webhook signature verification
Pick the right one
Dependencies
| Language | Dependencies | Notes |
|---|---|---|
| Python | requests (or httpx / urllib3) | hmac / hashlib / secrets are stdlib |
| Node.js | Node.js ≥ 18 (native fetch) | crypto is built-in |
| Go | stdlib crypto/hmac / crypto/sha256 / net/http | No third-party deps |
| Java | JDK 11+ stdlib (HttpClient / Mac / MessageDigest) | No third-party deps |
| PHP | PHP 7.4+ with curl extension | hash_hmac / random_bytes are built-in |
| cURL | openssl + awk | Generic shell tools |
Common Variables
APP_ID = "cp_a1b2c3d4..." # 31 chars, cp_ + 28 hex
SECRET = "f1e2d3c4..." # 64 hex chars
BASE = "https://api.coinepay.net"Don't hardcode
Samples have SECRET inline for clarity; production code should read from env vars / Vault / Secret Manager.