You can edit webhooks on your resource by going to your resource page and clicking the "Webhooks" button in the edit section.

Automatic Discord Integration
Polymart automatically integrates with Discord webhooks. However, this doesn't give you nearly as much customization as if you build your own API for receiving webhooks. If you want to learn more about how to build your own API for receiving webhooks, keep reading!

Webhook Overview
ping — Sent whenever you click the "ping" button on your resource's webhooks page

product.update — Sent whenever you post an update to your resource
product.user.purchase — Sent when a user purchases your resource
product.user.purchaseRemoved — Sent when a user issues a chargeback or is refunded
product.user.firstDownload — Sent when a user first downloads your resource

About Webhooks
When a webhook event is called, Polymart will send a request to the URL you provide on your resource page. With each request, the following headers will be sent:

X-Polymart-Webhook-Version: 1

X-Polymart-Signature will be a signature that verifies that the webhook request is in-fact valid. This is a SHA256 HMAC hash, where the data is the data that was POSTed, and the key is your webhook secret. Your webhook secret generated when you create a new webhook. YOU MUST VALIDATE THAT THIS IS CORRECT. If you do not, attackers will easily be able to send random or malicious webhooks to your server

The data that is POSTed to your webhook will be in this format
{
    "event": "",
    "time": "",
    "nonce": "",
    "payload": {
        "": "",
        "": "",
        "<...>": "<...>"
    }
}
So, the top-level information might look something like this
{
    "event": "product.update",
    "time": 1744708015,
    "nonce": "O_5ZZ1Wzi5-W2yxo",
    "payload": "<...>"
}
Putting it all together, this is what a full valid request to https://example.com/polymartWebhook might look like, given the webhook secret
POST /polymartWebhook HTTP/1.1
X-Polymart-Webhook-Version: 1
X-Polymart-Signature: 28fa6c65b7a67217acab76af95fcd5b13411ff65657382234495f71dd410e40d
Content-Type: application/json
Content-Length: 166

{
    "event": "testEvent",
    "time": 1744708015,
    "nonce": "mUP61ni8W2mAt3qa",
    "payload": {
        "webhook": "https://example.com/polymartWebhook"
    }
}
Use this to test your webhook! This webhook event is called when you click the "send a ping" button on your resource's webhooks page.

Format
{
    "event": "ping",
    "time": "",
    "nonce": "",
    "payload": {
        "product": {
            "id": "",
            "title": "",
            "subtitle": "",
            "url": ""
        },
        "webhook": {
            "url": ""
        }
    }
}
Example
{
    "event": "ping",
    "time": 1744708015,
    "nonce": "iuCF6JJNczxtmzgl",
    "payload": {
        "product": {
            "id": "1",
            "title": "CustomItems",
            "subtitle": "Design new Custom items and blocks!",
            "url": "https://polymart.org/resource/1"
        },
        "webhook": {
            "url": "https://example.com/polymartWebhook"
        }
    }
}
product.update Back to top
This webhook event is called when your resource is updated.

Format
{
    "event": "resource.update",
    "time": "",
    "nonce": "",
    "payload": {
        "product": {
            "id": "",
            "title": "",
            "subtitle": "",
            "url": ""
        },
        "previous": {
            "version": "",
            "id": "",
            "time": "",
            "size": "",
            "fileType": "",
            "branch": ""
        },
        "update": {
            "version": "",
            "id": "",
            "time": "",
            "size": "",
            "fileType": "",
            "branch": "",
            "title": "",
            "description": ""
        }
    }
}
Example
{
    "event": "product.update",
    "time": 1744708015,
    "nonce": "V5h2MDK8VVwENxvb",
    "payload": {
        "product": {
            "id": "1",
            "title": "CustomItems",
            "subtitle": "Design new Custom items and blocks!",
            "url": "https://polymart.org/resource/1"
        },
        "previous": {
            "version": "2.19.5",
            "id": "91",
            "time": 1744704415,
            "size": "716624",
            "fileType": "jar",
            "branch": "snapshot"
        },
        "update": {
            "version": "3.0",
            "id": "107",
            "time": 1744708015,
            "size": "718232",
            "fileType": "jar",
            "branch": "release",
            "title": "Automatic Resource Pack Generation",
            "description": "This version adds an automatic resource pack generator to CustomItems!"
        }
    }
}
product.user.purchase Back to top
This webhook event is called when a user purchases your resource

Format
{
    "event": "product.user.purchase",
    "time": "",
    "nonce": "",
    "payload": {
        "product": {
            "id": "",
            "title": "",
            "subtitle": "",
            "url": ""
        },
        "user": {
            "id": ""
        }
    }
}
Example
{
    "event": "product.user.purchase",
    "time": 1744708015,
    "nonce": "nUyBQpiYZwZdLlal",
    "payload": {
        "product": {
            "id": "1",
            "title": "CustomItems",
            "subtitle": "Design new Custom items and blocks!",
            "url": "https://polymart.org/resource/1"
        },
        "user": {
            "id": 110997
        }
    }
}
product.user.purchaseRemoved Back to top
This webhook event is called when you issue a refund to a user, or they issue a chargeback. This event may be called more than once for a given user

Format
{
    "event": "product.user.purchaseRemoved",
    "time": "",
    "nonce": "",
    "payload": {
        "product": {
            "id": "",
            "title": "",
            "subtitle": "",
            "url": ""
        },
        "user": {
            "id": ""
        }
    }
}
Example
{
    "event": "product.user.purchaseRemoved",
    "time": 1744708015,
    "nonce": "hOyvim-_0ccmjfZP",
    "payload": {
        "product": {
            "id": "1",
            "title": "CustomItems",
            "subtitle": "Design new Custom items and blocks!",
            "url": "https://polymart.org/resource/1"
        },
        "user": {
            "id": 172290
        }
    }
}
product.user.firstDownload Back to top
This webhook event is called when a user downloads your resource for the first time

Format
{
    "event": "product.user.firstDownload",
    "time": "",
    "nonce": "",
    "payload": {
        "product": {
            "id": "",
            "title": "",
            "subtitle": "",
            "url": ""
        },
        "user": {
            "id": ""
        }
    }
}
Example
{
    "event": "product.user.firstDownload",
    "time": 1744708015,
    "nonce": "7JTGyXlzi8ddYGHl",
    "payload": {
        "product": {
            "id": "1",
            "title": "CustomItems",
            "subtitle": "Design new Custom items and blocks!",
            "url": "https://polymart.org/resource/1"
        },
        "user": {
            "id": 157664
        }
    }
}