
Payment Methods
Part of Checkout integrations
Passing discount and shipping data correctly
Keep discounts, delivery choices and payment amounts consistent as a checkout basket changes.
Treat each checkout state as a versioned order snapshot: item quantities and discounted prices, promotion code, delivery method and charge, tax treatment, currency and payable total. Recalculate it after a basket, destination or service change, then use the current version for payment and the saved order. A code by itself cannot establish the amount to charge.
Define the price data contract
Identify the merchant rules that determine promotion eligibility and the delivery methods available for the destination. Record their inputs, including items, quantities, destination, selected service and applicable conditions. Calculate item amounts, discounts, delivery charge, tax treatment, currency and payable total under the same rules.
Use consistent meanings for items subtotal, discount, delivery and amount payable. Carry a basket or calculation version so a late delivery quote cannot overwrite a newer total. If a quote fails, mark the service or charge unresolved and prevent payment against an unsupported total.
Change / Data to check
- Promotion applied or removed
- Eligibility, discount treatment, displayed total and payment amount.
- Address changed
- Services and charges available for the new destination.
- Delivery service changed
- Selected service, charge and revised total.
- Quantity changed
- Promotion threshold, delivery eligibility and downstream amounts.
For a shared shipping record, Adobe Experience Platform's XDM Shipping data type names shippingMethod, shippingAmount, currencyCode, shippingDestination and address. shippingAmount is the amount paid for shipping, and currencyCode is the ISO 4217 alphabetic currency code. Use the method, destination and address fields alongside the amount so a charge stays tied to the choice that produced it.
An address can change both the available methods and their rates. In commercetools, the Cart shippingAddress determines available Shipping Methods and shipping rates, as well as the tax rate applied to each (Custom) Line Item and the shipping rate. Re-resolve those values after an address change before saving the current snapshot.
Check the amount at payment
After a basket change, rerun promotion eligibility and recalculate item amounts and discounts. After an address or service change, re-resolve the available method and charge, then recalculate tax treatment and the payable total. Do not reuse a snapshot from before the change.
Complete recalculation before enabling the final payment action. Keep the selected delivery choice, payment request and saved order tied to the same current snapshot. If a delivery quote is unresolved, do not allow payment against its unsupported amount.
Stripe Checkout Session creation accepts line_items for the items being purchased and client_reference_id, which can refer to a cart or similar identifier for reconciliation with internal systems. Pass the current items in line_items and use the reference to connect the session with the matching basket or calculation snapshot.
Compare amounts in the same currency and at the same rounding point. If they differ, inspect discount allocation, delivery and tax treatment rather than changing a provider amount merely to force a match.
Map analytics separately
GA4 purchase value is item revenue, excluding shipping and tax; it is not the full payable order amount. An item discount is not automatically subtracted from price, so report the unit price after discount.
For a GA4 purchase event, put an order-level code in event-level coupon; an item-level coupon can also be included. Send each unit discount in item discount as an amount, not a percentage, and send the already-discounted unit amount in price.
In a GA4 example using USD, three units originally priced at $10.00 each receive a $2.00 unit discount, and one unit originally priced at $22.00 receives a $4.40 discount. The resulting prices are $8.00 and $17.60, and item value is $41.60; shipping and tax remain outside that value.
Test a discounted order with paid delivery, then change the destination or service and remove the discount. At each stage compare the item amounts, shippingMethod, shippingAmount, payment request and saved order. Include an unavailable delivery quote and keep payment disabled until its amount is resolved.
GA4 Purchase Event Data Mapping
- GA4 `value`
- Item revenue only (excludes shipping and tax)
- Item `price`
- Price after discount applied (in USD or local currency)
- Item `discount`
- Amount (not percentage) of discount per unit
- Order-level `coupon`
- Use event-level `coupon` field for promo code tracking



