View Categories

Webhooks in PublishPress Cart

A webhook sends an HTTP GET or POST request to a URL when a Cart trigger runs. Use it to run actions in third-party platforms and other external APIs that accept webhook requests.

This integration is available in PublishPress Cart Free and Pro.


Before you start #

You need:

  • PublishPress Cart Free or Pro installed and active.
  • The URL that receives the request, from the platform or API you send data to.
  • A product in Cart. Create one under Cart → Products.

Add a webhook to a product #

  1. Go to Cart → Products and open the product.
  2. Open the Integrations tab.
  3. Click Add New.
  4. In Service, choose Webhook.
  5. In Trigger, choose the event that runs the webhook.
  6. In Method, choose GET or POST.
  7. In Webhook URL, enter the URL that receives the request.
  8. Optional: turn on Include headers, then enter each header on its own line in Headers.
  9. Optional: in Field map, map order information to your own keys. See the field map section below.
  10. Click Publish or Update.

The webhook settings on a product look like this:

PublishPress Cart webhook integration settings on a product

Field map and Headers are both optional. If they are empty, Cart sends all available order information in the body, with the header Content-Type: application/json; charset=utf-8.


Use variables with the GET method #

With GET, add variables to the Webhook URL. See the Personalization Fields article for the list of variables you can use.


Check the POST parameters #

With POST, Cart includes these parameters in the request:

Variable nameDescription
bump_amount(decimal) Order bump amount
bump_id(integer) Bump product ID
bump_name(string) Bump product name
coupon(string) Coupon code used at checkout
currency(string) Uppercase, 3-character currency code, such as USD or GBP
customer_country(string) Customer country
customer_email(string) Customer’s email address
customer_firstname(string) Customer’s first name
customer_lastname(string) Customer’s last name
customer_name(string) Customer’s full name
customer_phone(string) Customer’s phone number
order_id(integer) Order ID
order_amount(decimal) Total order amount
order_status(string) Order status
order_url(string) The page the order was placed on
payment_plan(string) The name of the selected payment plan
product_id(string) The main product’s ID
product_name(string) The main product’s name
studiocart_secret(string) The secret is the same as the API Key found under Cart → Settings. See the next section.
total order excluding VAT(string) Pre-tax amount
VAT amount charged(string) Tax amount
VAT number(string) VAT number
VAT percentage charged(string) Tax rate
website_url(string) The website URL
XXXXXX(string) Custom field information. Replace XXXXXX with the ID of your custom field.
"XXX"(string) Static value wrapped in double quotes. Replace XXX with the string you want to send to the webhook.

Verify the request with your API key #

The studiocart_secret value is the same as the API Key in Cart → Settings. On the platform that receives the data, check that this value matches your API Key. This makes sure nobody else can post data to your URL.


Map order data to your own keys #

Use Field map to map order information to custom keys. You can use any variable from the table above. For custom fields and static values, also use:

Variable nameDescription
XXXXXX(string) Custom field information. Replace XXXXXX with the ID of your custom field.
"XXX"(string) Static value wrapped in double quotes. Replace XXX with the string you want to send to the webhook.
  1. In Field map, enter the field key, a colon, then the matching Cart variable.
  2. Put one pair on each line.

For example:

NAME : customer_name
TEST_FIELD : "static value"