CartThrob 9 documentation for ExpressionEngine commerce teams Visit CartThrob.com
CartThrob.com

Gateway Fields URL

gateway_fields_url returns the CartThrob action URL for change_gateway_fields_action. Use it when you want to request selected-gateway markup through an action instead of a template.

The tag only prints a URL. It does not print gateway fields. This is a low-level helper: hosted gateways can also depend on scripts, hidden state, and event handlers initialized with the complete checkout form. Do not use this URL to replace only the gateway-field HTML when a customer changes gateways. Save the selection and render a complete new checkout page instead.

See also:

Parameters

This tag has no tag-specific parameters.

Output

Returns a URL:

{site_index}?ACT={action_id}

Behavior and Constraints

  1. The action exits unless the request is AJAX (X-Requested-With: XMLHttpRequest).
  2. Posted gateway is the same value gateway_select submits.
  3. Use a full-page reload after set_gateway, particularly for Stripe, PayPal, and Authorize.net hosted fields.

Examples

Print the action URL:

{exp:cartthrob:gateway_fields_url}

For a customer-facing gateway selector, follow Allow the customer to select a gateway: save the gateway selection, reload the complete checkout page, and let the selected gateway initialize all of its fields and scripts together.