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

Gateway Fields

{exp:cartthrob:gateway_fields} outputs gateway-specific HTML form fields for the currently active payment gateway.

This tag is typically used inside checkout templates to render payment fields required by the selected gateway.

See also:

Parameters

This tag has no tag-specific parameters.

Output

Returns HTML markup generated by the active payment gateway integration.

Use this output directly in checkout form templates where gateway fields should appear.

Behavior and Constraints

  1. Output comes directly from ee()->api_cartthrob_payment_gateways->gateway_fields().
  2. Rendered fields depend on the currently selected/active gateway context.
  3. This tag is commonly used in checkout template flows.
  4. For dynamic gateway switching in AJAX or selected-gateway flows, use related patterns with selected_gateway_fields and gateway_fields_url.
  5. Output can contain standard customer fields in addition to payment fields. Do not render duplicate inputs with the same names or IDs elsewhere in the checkout form.
  6. A configured Gateway Fields Template replaces the default generated output and becomes responsible for every required customer field and gateway integration element.
  7. error_handling="inline" remains compatible with generated fields, but the checkout template must render the error summary or field-specific variables. CartThrob does not automatically insert error markup beside generated inputs.

For a complete inline-error example and field-ownership guidance, see checkout_form: Gateway-generated fields and inline errors.

Examples

Basic checkout usage:

{exp:cartthrob:checkout_form return="store/order_info"}
    {exp:cartthrob:gateway_fields}
    <button type="submit">Place Order</button>
{/exp:cartthrob:checkout_form}

Twig checkout usage (render raw HTML):

{{ exp.cartthrob.gateway_fields() | raw }}