Receive a mandatory Shopify privacy webhook
curl --request POST \
--url https://api.app.lastaccountingcompany.com/portal/shopify/privacy/webhooks \
--header 'Content-Type: application/json' \
--header 'X-Shopify-Hmac-Sha256: <api-key>' \
--header 'X-Shopify-Shop-Domain: <x-shopify-shop-domain>' \
--header 'X-Shopify-Topic: <x-shopify-topic>' \
--header 'X-Shopify-Webhook-Id: <x-shopify-webhook-id>' \
--data '
{
"shop_id": 2,
"shop_domain": "<string>",
"customer": {
"id": 123
},
"orders_to_redact": [
123
],
"orders_requested": [
123
]
}
'import requests
url = "https://api.app.lastaccountingcompany.com/portal/shopify/privacy/webhooks"
payload = {
"shop_id": 2,
"shop_domain": "<string>",
"customer": { "id": 123 },
"orders_to_redact": [123],
"orders_requested": [123]
}
headers = {
"X-Shopify-Shop-Domain": "<x-shopify-shop-domain>",
"X-Shopify-Topic": "<x-shopify-topic>",
"X-Shopify-Webhook-Id": "<x-shopify-webhook-id>",
"X-Shopify-Hmac-Sha256": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Shopify-Shop-Domain': '<x-shopify-shop-domain>',
'X-Shopify-Topic': '<x-shopify-topic>',
'X-Shopify-Webhook-Id': '<x-shopify-webhook-id>',
'X-Shopify-Hmac-Sha256': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
shop_id: 2,
shop_domain: '<string>',
customer: {id: 123},
orders_to_redact: [123],
orders_requested: [123]
})
};
fetch('https://api.app.lastaccountingcompany.com/portal/shopify/privacy/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.app.lastaccountingcompany.com/portal/shopify/privacy/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'shop_id' => 2,
'shop_domain' => '<string>',
'customer' => [
'id' => 123
],
'orders_to_redact' => [
123
],
'orders_requested' => [
123
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Shopify-Hmac-Sha256: <api-key>",
"X-Shopify-Shop-Domain: <x-shopify-shop-domain>",
"X-Shopify-Topic: <x-shopify-topic>",
"X-Shopify-Webhook-Id: <x-shopify-webhook-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.app.lastaccountingcompany.com/portal/shopify/privacy/webhooks"
payload := strings.NewReader("{\n \"shop_id\": 2,\n \"shop_domain\": \"<string>\",\n \"customer\": {\n \"id\": 123\n },\n \"orders_to_redact\": [\n 123\n ],\n \"orders_requested\": [\n 123\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Shopify-Shop-Domain", "<x-shopify-shop-domain>")
req.Header.Add("X-Shopify-Topic", "<x-shopify-topic>")
req.Header.Add("X-Shopify-Webhook-Id", "<x-shopify-webhook-id>")
req.Header.Add("X-Shopify-Hmac-Sha256", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.app.lastaccountingcompany.com/portal/shopify/privacy/webhooks")
.header("X-Shopify-Shop-Domain", "<x-shopify-shop-domain>")
.header("X-Shopify-Topic", "<x-shopify-topic>")
.header("X-Shopify-Webhook-Id", "<x-shopify-webhook-id>")
.header("X-Shopify-Hmac-Sha256", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"shop_id\": 2,\n \"shop_domain\": \"<string>\",\n \"customer\": {\n \"id\": 123\n },\n \"orders_to_redact\": [\n 123\n ],\n \"orders_requested\": [\n 123\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.app.lastaccountingcompany.com/portal/shopify/privacy/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Shopify-Shop-Domain"] = '<x-shopify-shop-domain>'
request["X-Shopify-Topic"] = '<x-shopify-topic>'
request["X-Shopify-Webhook-Id"] = '<x-shopify-webhook-id>'
request["X-Shopify-Hmac-Sha256"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"shop_id\": 2,\n \"shop_domain\": \"<string>\",\n \"customer\": {\n \"id\": 123\n },\n \"orders_to_redact\": [\n 123\n ],\n \"orders_requested\": [\n 123\n ]\n}"
response = http.request(request)
puts response.read_bodyShopify App
Receive a mandatory Shopify privacy webhook
Verifies Shopify’s HMAC over the untouched request bytes, routes the shop to its canonical tenant when possible, and durably queues the privacy request. During the last custom-app migration, the exact shop-bound legacy secret and the public-app secret are both accepted.
POST
/
shopify
/
privacy
/
webhooks
Receive a mandatory Shopify privacy webhook
curl --request POST \
--url https://api.app.lastaccountingcompany.com/portal/shopify/privacy/webhooks \
--header 'Content-Type: application/json' \
--header 'X-Shopify-Hmac-Sha256: <api-key>' \
--header 'X-Shopify-Shop-Domain: <x-shopify-shop-domain>' \
--header 'X-Shopify-Topic: <x-shopify-topic>' \
--header 'X-Shopify-Webhook-Id: <x-shopify-webhook-id>' \
--data '
{
"shop_id": 2,
"shop_domain": "<string>",
"customer": {
"id": 123
},
"orders_to_redact": [
123
],
"orders_requested": [
123
]
}
'import requests
url = "https://api.app.lastaccountingcompany.com/portal/shopify/privacy/webhooks"
payload = {
"shop_id": 2,
"shop_domain": "<string>",
"customer": { "id": 123 },
"orders_to_redact": [123],
"orders_requested": [123]
}
headers = {
"X-Shopify-Shop-Domain": "<x-shopify-shop-domain>",
"X-Shopify-Topic": "<x-shopify-topic>",
"X-Shopify-Webhook-Id": "<x-shopify-webhook-id>",
"X-Shopify-Hmac-Sha256": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Shopify-Shop-Domain': '<x-shopify-shop-domain>',
'X-Shopify-Topic': '<x-shopify-topic>',
'X-Shopify-Webhook-Id': '<x-shopify-webhook-id>',
'X-Shopify-Hmac-Sha256': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
shop_id: 2,
shop_domain: '<string>',
customer: {id: 123},
orders_to_redact: [123],
orders_requested: [123]
})
};
fetch('https://api.app.lastaccountingcompany.com/portal/shopify/privacy/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.app.lastaccountingcompany.com/portal/shopify/privacy/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'shop_id' => 2,
'shop_domain' => '<string>',
'customer' => [
'id' => 123
],
'orders_to_redact' => [
123
],
'orders_requested' => [
123
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Shopify-Hmac-Sha256: <api-key>",
"X-Shopify-Shop-Domain: <x-shopify-shop-domain>",
"X-Shopify-Topic: <x-shopify-topic>",
"X-Shopify-Webhook-Id: <x-shopify-webhook-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.app.lastaccountingcompany.com/portal/shopify/privacy/webhooks"
payload := strings.NewReader("{\n \"shop_id\": 2,\n \"shop_domain\": \"<string>\",\n \"customer\": {\n \"id\": 123\n },\n \"orders_to_redact\": [\n 123\n ],\n \"orders_requested\": [\n 123\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Shopify-Shop-Domain", "<x-shopify-shop-domain>")
req.Header.Add("X-Shopify-Topic", "<x-shopify-topic>")
req.Header.Add("X-Shopify-Webhook-Id", "<x-shopify-webhook-id>")
req.Header.Add("X-Shopify-Hmac-Sha256", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.app.lastaccountingcompany.com/portal/shopify/privacy/webhooks")
.header("X-Shopify-Shop-Domain", "<x-shopify-shop-domain>")
.header("X-Shopify-Topic", "<x-shopify-topic>")
.header("X-Shopify-Webhook-Id", "<x-shopify-webhook-id>")
.header("X-Shopify-Hmac-Sha256", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"shop_id\": 2,\n \"shop_domain\": \"<string>\",\n \"customer\": {\n \"id\": 123\n },\n \"orders_to_redact\": [\n 123\n ],\n \"orders_requested\": [\n 123\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.app.lastaccountingcompany.com/portal/shopify/privacy/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Shopify-Shop-Domain"] = '<x-shopify-shop-domain>'
request["X-Shopify-Topic"] = '<x-shopify-topic>'
request["X-Shopify-Webhook-Id"] = '<x-shopify-webhook-id>'
request["X-Shopify-Hmac-Sha256"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"shop_id\": 2,\n \"shop_domain\": \"<string>\",\n \"customer\": {\n \"id\": 123\n },\n \"orders_to_redact\": [\n 123\n ],\n \"orders_requested\": [\n 123\n ]\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Base64 SHA-256 HMAC over the untouched request body.
Headers
Pattern:
^[a-z0-9][a-z0-9-]*\.myshopify\.com$Available options:
customers/data_request, customers/redact, shop/redact Required string length:
1 - 200Body
application/json
Response
The privacy request is durably queued or is an identical replay.