결제
암호화폐 결제 — 110개 이상 코인을 지원하는 호스팅 결제창과 API 화이트 라벨 — 결제 흐름 전체를 내 브랜드로 자금 처리 — 자동 전환, 출금, 통제 기능 대량 지급 — API 또는 파일로 암호화폐 대량 지급 플랫폼 — 마켓플레이스 결제와 수수료 산업 — 게임, 호스팅, SaaS 등을 위한 암호화폐 결제 결제 수단 — 암호화폐, 카드, Apple Pay, PayPal 및 현지 결제 수단
스왑 플러그인 제휴 프로그램 요금 블로그 문서 문의하기
언어
로그인
API and webhooks

Check that a webhook really came from us

Verify the signature, then confirm with a lookup.

Updated 2 min read

Anyone can send a request to your webhook address, so check each one before you deliver anything.

Two checks

  1. Verify the signature. Every webhook carries an X-CryptoPayr-Signature header: an HMAC-SHA256 of the raw request body, made with your API key. Compute the same value and compare.
  2. Confirm with a lookup. Ask our API for the payment by its ID and use the status and amount from that answer.

Code for PHP, Node.js and Python is in Fulfil orders safely. Our SDKs and plugins do both checks for you.

"Invalid signature" although the webhook is real

  • The body was changed before you checked it. Sign the raw bytes exactly as received, not a re-encoded JSON object. Many frameworks parse the body first: read the raw body instead.
  • Wrong key. Live webhooks are signed with your secret key, test webhooks with your test key.
  • The key was regenerated. Use the current one.
  • A proxy rewrote the request. Compression or security layers that alter the body break the signature.

The same webhook twice

A resend or a retry can deliver an event more than once. Record the payment ID when you fulfil an order and skip it if you have seen it before.

Was this article helpful?