Advanced WPG features: DCC, Guaranteed Payments, Prime Routing, Revenue Boost, Lodging, MAC, zero-value auth, stored credentials, submission fulfillment, and JSC device data snippet builder.
All Builder.* functions return XML fragments to embed in a WPG order
or modification. Wrap with Worldpay.WPG.Builder.envelope/2 before
submitting via Worldpay.WPG.submit/2.
Summary
Functions
Build a WPG Account Name Inquiry request.
Build an order XML with a convenience fee (WPG).
Build a DCC enquiry order (step 1 — get offered rate).
Build a DCC payment after customer accepts or declines DCC offer.
Parse DCC status from a WPG XML response map.
Build a dynamic MCC XML element for per-transaction MCC override.
Embed inside a WPG order <paymentDetails> element.
Build a WPG Fast Refund modification (≤30 min credit).
Build a Guaranteed Payments (Signifyd) order with device session data.
Returns the JavaScript snippet string for WPG Device and Behavioral JSC.
Add lodging (hotel) data to a WPG order for lower interchange.
Parse Mastercard Authorization Optimizer (MAC) code from WPG response.
Build a Prime Routing debit sale order.
Parse Revenue Boost NPT upgrade from WPG response.
Parse AVS and CVC risk factors from a WPG XML response.
Add stored credential data to a WPG order.
Build a WPG submission fulfillment modification.
Build an order XML with a surcharge element (WPG).
Build a zero-value authorization order to check card validity (WPG).
Functions
Build a WPG Account Name Inquiry request.
Used to verify account holder name before payouts.
@spec convenience_fee_xml(non_neg_integer(), String.t()) :: String.t()
Build an order XML with a convenience fee (WPG).
Convenience fees apply to all payment methods.
Build a DCC enquiry order (step 1 — get offered rate).
Submit before the actual payment. Customer chooses their currency.
Then submit the payment with dcc_payment/1 including their choice.
Build a DCC payment after customer accepts or declines DCC offer.
Options
:dcc_accepted— boolean (customer accepted DCC?):dcc_currency— offered currency code (if accepted):dcc_amount— amount in offered currency (if accepted):dcc_rate— exchange rate (if accepted):dcc_rate_type— rate type (if accepted):dcc_margin— margin percentage (if accepted)
Parse DCC status from a WPG XML response map.
Returns one of: "ACCEPTED" | "DECLINED" | "NOT_OFFERED" | "NOT_AVAILABLE" | nil
Build a dynamic MCC XML element for per-transaction MCC override.
Embed inside a WPG order <paymentDetails> element.
Build a WPG Fast Refund modification (≤30 min credit).
Options
:order_code— original order code:amount— refund amount:currency— currency code
Build a Guaranteed Payments (Signifyd) order with device session data.
The web_session_id is collected by the Signifyd JSC snippet on the
checkout page and identifies the device session for fraud assessment.
Options
:web_session_id— Signifyd device session ID (required):shopper_email— customer email:shopper_ip— customer IP address:subscription— boolean (recurring payment?)
Returns the JavaScript snippet string for WPG Device and Behavioral JSC.
Embed in checkout page HTML. The session_id is used as the
webSessionId / <message> in FraudSight / Guaranteed Payments requests.
Parameters
session_id— unique session identifier for the checkout sessionenvironment—:try|:live
Add lodging (hotel) data to a WPG order for lower interchange.
Options
:hotel_folio_number— folio/invoice number:check_in_date— YYYY-MM-DD:check_out_date— YYYY-MM-DD:duration_of_stay— integer (nights):fire_safe_indicator— boolean:program_code— Mastercard lodging program code:charge_type— "RESTAURANT" | "GIFTSHOP" | "MINIBAR" | "TELEPHONE" | "LAUNDRY" | "OTHER"
Parse Mastercard Authorization Optimizer (MAC) code from WPG response.
Build a Prime Routing debit sale order.
Prime Routing routes eligible debit transactions to the lowest-cost network. Requires Sale (not Authorization-only) transaction type.
Parse Revenue Boost NPT upgrade from WPG response.
@spec risk_factors(%{required(String.t()) => term()}) :: %{ cvc: String.t() | nil, avs_address: String.t() | nil, avs_postcode: String.t() | nil }
Parse AVS and CVC risk factors from a WPG XML response.
Returns `%{cvc: "MATCHED" | "NOT_MATCHED" | "NOT_SENT_TO_ACQUIRER" | nil,
avs_address: "MATCHED" | ... | nil,
avs_postcode: "MATCHED" | ... | nil}`
Add stored credential data to a WPG order.
reason values:
"UNSCHEDULED" | "SUBSCRIPTION" | "INSTALLMENT" | "RESUBMISSION" |
"REAUTHORISATION" | "DELAYED_CHARGE" | "NO_SHOW"
usage values:
"FIRST" | "USED"
Build a WPG submission fulfillment modification.
Used for deferred capture: pre-orders, delayed shipping, subscriptions. Marks an authorized order as ready for capture/settlement.
Options
:order_code— original order code:fulfillment_data— optional fulfillment metadata map
@spec surcharge_xml(non_neg_integer(), String.t()) :: String.t()
Build an order XML with a surcharge element (WPG).
Surcharges apply to credit cards only and cannot be combined with convenience fees.
Build a zero-value authorization order to check card validity (WPG).
Use with CVC and AVS to validate a card without charging it. Response includes riskFactors for CVC/AVS match results.