Why use webhooks?
Without webhooks, your application would have to keep asking the API, every few seconds, “was this purchase approved yet?” — slow and inefficient. With webhooks, the platform tells you immediately, and you can:- update the status of an order in your system
- fire conversion events in your tracker
- trigger automations — emails, fulfillment, CRM
- record financial movements
How it works
- You create an HTTPS endpoint in your system, e.g.
https://yoursite.com/webhooks/pagamerican. - You register that endpoint in Integrations > Webhooks and pick which events it should receive.
- When an enabled event happens, the platform sends a
POSTwithContent-Type: application/jsonto your URL. - Your system processes the event and responds with a success status (2xx).
{some_value}) is performed.
Creating a webhook in the dashboard
1
Open Integrations > Webhooks
This is where you create and manage your notification endpoints. Click to create a new one.
2
Configure the endpoint
Give it a name (internal use, to tell your integrations apart) and the HTTPS URL that will receive the events.
3
Pick the events
Enable the events this endpoint should receive. Each endpoint has its own toggles, independent from the others.
4
Set the product scope and save
All products, specific products, or specific offers of a single product.
Supported events
The detailed payload of each event is documented individually in the Events section in the sidebar. Every order payload includes an
isTest flag so you can tell test deliveries apart.
Tracking parameters
The checkout captures the query string of the link that brought the buyer. Order events return it in thetrackingParameters object with a fixed set of keys: src, sck, utm_source, utm_campaign, utm_medium, utm_content, and utm_term.
Keys outside this set (a custom parameter of your own, for example) are not returned. If you need an identifier of yours back in the payload, send it in src, sck, or one of the utm_* parameters.
Exception: Abandoned cart returns the full captured query string, unfiltered, in the
searchParams field.Amounts and commission
Every order-related event includes acommission object with the transaction amounts, always in cents:
totalPriceInCents— total sale amount (the ticket).userCommissionInCents— net commission of whoever registered the endpoint (creator or affiliate).gatewayFeeInCents— fee charged on the transaction.currency— transaction currency.
products[].priceInCents.
The amounts breakdown
Purchase approved, Order status updated, and Order refunded also include an amounts object with the full financial breakdown of the charge — items, coupons, shipping, tax, and the total the customer actually paid:
itemsGrossInCents,itemsCouponInCents,itemsNetInCents— items total, coupon discount on items, and items total after coupons.shippingGrossInCents,shippingCouponInCents,shippingNetInCents— the same breakdown for shipping.taxesInCents— sales tax amount.totalInCents— the amount actually charged to the customer.currency— transaction currency, uppercase (e.g.USD).
totalInCents is the charged amount and is not always the sum of the other fields: when the tax is inclusive, it is already embedded in the item price.Initiate checkout and Abandoned cart don’t include amounts — tax is only calculated at payment time.Best practices
- Use HTTPS on every endpoint.
- Respond quickly with a 2xx and process the heavy work asynchronously — each delivery attempt waits at most 10 seconds.
- Process idempotently: deliveries are at-least-once, so duplicates are possible. Use
orderId+eventto detect events you already handled. - Don’t assume ordering between events of the same order — use
statusandupdatedAtfrom the payload to determine the latest state. - Don’t strictly validate the entire payload schema: new fields may be added over time and shouldn’t break your endpoint.
Need help?
Our team can help you set up your integration — support@pagamerican.com