NFT Webhooks

NFT Webhooks

Magic provides webhooks to determine if NFT minting has succeeded or failed. For both NFT Minting and Delivery and NFT Checkout we will send a webhooks event to your backend for every token minted. Our team will configure these during the onboarding process. Your endpoint can be named anything and can accept any static parameters, but it must meet the following requirements:

  • Accept POST requests
  • Return a 200 response for both success and failure notifications

Example Webhook POST Requests

Javascript
01// Success
02{
03	"status": "ok",
04	"request_id": "abcd1234",
05	"message": "Mint was successful!"
06}
07
08// Failure
09{
10	"status": "error",
11        "request_id": "abcd1234",
12	"message": "Mint failed during the minting step - please reach out to Magic support"
13}

#Response Status

The possible "status" and "message" values that can be sent to your webhook are:

  • "status": "ok", "message": "Mint was successful!"
  • "status": "error", "message": "Mint failed during the minting step - please reach out to Magic support"
  • "status": "error", "message": "Mint failed during the transfer step - please reach out to Magic support"

Errors can happen in either the minting or transfer step. Reach out to Magic Support for more detail about any errors.

#Decryption

Your Magic Customer Success representative will send you a key to decrypt the messages, using HS256. Below is an example code snippet for decrypting: ⁠

Python
01import jwt
02
03payload = jwt.decode("encrypted_payload_string", sign_key, "HS256")

NFT Webhooks