Icone PayDocsTypeScript SDK
The official icone-pay-sdk wraps the API with typed requests and webhook verification.
Install
The SDK works in any Node 18+ environment. It validates your payload locally before sending and ships full TypeScript types.
Initialize a Payment
Create a client with your route API key and call initPayment. The same payload as the REST API is accepted, including paymentCurrency, allowPayOnDelivery and sellerId.
Pass
mode: "test" to route the request to the test endpoint while integrating.Verify Webhooks
Use verifyWebhook to validate the X-IconePay-Signature header and get a typed event. Pass the raw request body and that route's Signing Secret.
Exports
| Export | Description |
|---|---|
IconePaySDK | Client with initPayment(). |
verifyWebhook | Verify a signature and parse the event. |
WebhookVerificationError | Thrown when verification fails. |
initPaymentSchema | The Zod schema, for validating separately. |
Types | InitPaymentParams, WebhookEvent, Currency, … |