Add shipping, base currency, and payment data to purchase events - #44
Merged
Merged
Conversation
AdPage calculates per-order profit (COGS, carrier rate, payment fees) from the order_created payload. Two things were missing to do that exactly: - the chosen shipping method, so the real carrier rate can be applied - shipping/order totals excl. tax and in the store base currency, so multi-currency shops don't mix currencies in the profit calculation Adds to ecommerce: shipping_method, shipping_method_code, shipping_excl_tax, base_shipping_excl_tax, base_value, base_tax, base_currency and payment_type. Purely additive - shipping, value, tax, items, transaction_id and all other existing keys keep their current name, meaning and value so live tracking implementations are unaffected. Resolution is wrapped in a try/catch so a failure here can never break the webhook. Bumps the package version to 1.7.0 so the plugin_version in the payload tells AdPage whether the new fields are available. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FtDTszbhPXRNU49GjSuiPD
MikeVerlinde
approved these changes
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the purchase webhook event to include additional order data (shipping details, base currency values, and payment method) that AdPage uses to calculate actual profit metrics per order, including COGS, carrier rates, and payment fees.
Changes
PurchaseWebhookEvent.php: Added new ecommerce data fields to the purchase event payload:
shipping_method,shipping_method_code,shipping_excl_tax,base_shipping_excl_taxbase_value,base_tax,base_currencypayment_typecomposer.json: Version bump from 1.6.0 to 1.7.0
Implementation Details
priceFormatterservice to format monetary values consistentlyhttps://claude.ai/code/session_01FtDTszbhPXRNU49GjSuiPD