Detect card category before a surcharge
Coordinate Collect.js category detection, displayed totals and the final token callback.
Preview the category
In an existing Collect.js integration, lookUpCallback supplies category before tokenization. Read category, not brand type: Visa or Mastercard does not establish whether a card is credit or debit.
Confirm the tokenized card
Read callback.card.category again after tokenization. If it differs from the preview, recalculate and obtain confirmation of the revised total. Treat missing or unrecognized categories as ineligible for automatic surcharge application.
Keep the total consistent
Show the surcharge before confirmation and send the confirmed base-plus-surcharge amount for processing. Card detection alone does not establish program eligibility or an allowed rate. Keep the server authoritative for pricing and validate the configured program before enabling this flow.