Integrate Perfect Day into Shopify.
Sell your Perfect Day coupons through your Shopify store. The only slightly tricky part: Shopify's native webhook doesn't include metafields—you'll need a small bridge for that. We'll show you three ways, from the simplest to the most flexible.
Required beforehand: Go once the general preparation This involves creating a coupon, obtaining the application password, and providing the webhook URL. It takes approximately five minutes and applies to all shop systems.
Step 1 — Create product in the Shopify admin
-
One Shopify product per coupon
Shopify admin → Products → Add product. Enter the title, description, price, and images — just like with any other product. „"Save"" click.
Step 2 — Attach coupon ID to the product as a metafield
To ensure Shopify knows which platform coupon belongs to this product, you store the coupon ID as a meta field.
-
Create metafield definition once
Shopify admin → Settings → Custom data → Products → „Add definition". Fields:
- Name:
Perfect Day Coupon ID - Namespace and key:
perfectday.coupon_id - Type: Integer (one value)
Saving — this definition now applies to all products.
- Name:
-
Enter coupon ID for each product
In the product editor, scroll down to the block. „"Metafields"" → „"Perfect Day Coupon ID"" → Enter value (e.g.
15114) → „Save". The product is now linked to the platform coupon.
Step 3 — Set up Bridge (one of three options)
This is where Shopify alone isn't enough. Choose the option that fits your Shopify plan.
-
Option A — Shopify Flow (Plus/Advanced Plan)
If you have Shopify Plus or Advanced, Shopify Flow Already on board. Shopify admin → Apps → Shopify Flow → „Create workflow" → Template „"Order paid"". Add a „"Run code""-Action added with the following script:
View full code — JavaScript · Flow „Run code"
export default function transform(input) { const order = input.order; const items = order.lineItems.nodes .filter(li => li.product?.metafield?.value) .map(li => ({ coupon_id: parseInt(li.product.metafield.value, 10), count: li.quantity })); if (items.length === 0) return { skip: true }; return { payload: { shop_order_id: String(order.name), shop_type: "shopify", shop_domain: order.shop?.myshopifyDomain || "shop", customer: { email: order.customer?.email || order.email, name: `${order.customer?.firstName || ''} ${order.customer?.lastName || ''}`.trim(), locale: order.customerLocale || "de" }, items, order_total_cents: Math.round(parseFloat(order.totalPriceSet.shopMoney.amount) * 100), currency: order.totalPriceSet.shopMoney.currencyCode, placed_at: order.processedAt } }; } -
Option A — Append HTTP Request Action
Then a „"Send HTTP request""-Action: Method
POST, URLhttps://plattform.deinperfectday.de/wp-json/perfectday/shop/webhook/order, Body{{ steps.code.payload | json }}. Header:Content Type: application/json Authorization: Basic -
Create Base64 authentication
You generate the authorization value on Mac/Linux in the terminal — the result appears after
basicin the header. Then the workflow activate.echo -n "YOUR_USERNAME:YOUR APP PASSWORD" | base64 -
Option B — Bridge via Make.com / Zapier (any plan)
Are you using Shopify Basic/Starter without Flow? Create at make.com or Zapier a workflow — trigger „"Watch Orders (Paid)"", Action 1 „"Get a Product"" (retrieves the metafield), Action 2 „"HTTP → Make a request"" Using Basic Auth to the webhook URL. You can get a detailed screen recording upon support request.
-
Option C — Custom Cloud Function
For tech-savvy providers: a custom Cloud Function (Vercel / Cloudflare Workers / AWS Lambda) that receives the Shopify webhook, retrieves the meta field, and passes it to the Perfect-Day webhook. We will send a complete code template upon support request.
Step 4 — Test order
-
Place and check order
Place a test order in your Shopify store (use the bogus gateway if you don't want to trigger a real payment) and mark it as "paid". Then check:
- Platform back office → Perfect Day → Shop orders: new order with
shop_type=shopify? - Test customer mailbox: Did you receive the branded email with coupon codes and a print button?
- Platform back office → Perfect Day → Shop orders: new order with
Troubleshooting.
Webhook gives 401 — authentication required
Incorrect username — it's the WordPress username (user_login), not the email. Or the application password was revoked or copied incorrectly. If in doubt, generate a new one.
Webhook returns 403 — forbidden_coupon
The coupon_id The metafield doesn't exist in your platform's back office or belongs to another provider. Check under Vouchers, whether the ID appears there.
Webhook returns 400 — validation
Missing or invalid fields in the JSON body. Common: customer.email This is missing because the customer ordered as a guest. This needs to be caught in the flow/workflow.
The order goes through, but the customer receives no email.
In the platform's back office, open the order details and check the email status. Red indicates an SMTP problem on our end; please contact support. Otherwise, check the customer's spam folder.
The order will be processed twice.
No problem — the webhook has idempotence protection. You'll see it on the second attempt. duplicate: true In the response, no duplicate codes are generated and no duplicate emails are sent.
Would you prefer us to set it up for you?
Bridge configuration is the tricky part with Shopify. We'll set up your Shopify Flow or Make.com workflow completely for you—you just give us temporary access, and we'll take care of the rest.
Still questions?
Why do I even need a bridge?
Which option is the simplest?
Is the app password safe in the Bridge?
Shop connected — and now what?
Once the webhook is running, all orders will automatically appear in your back office. If you need another connection, each additional shop can be set up in just a few minutes.
Go to shop overview