Saving Payment Sources

Payment sources can only be saved when the selected payment gateway supports it.

There are two ways to store the payment information for supported gateways:

# 1. Pay and Save

You can pay for the order and have the card stored for future payments by adding a savePaymentSource parameter to any form with a value of true.

{% if cart.gateway.supportsPaymentSources() %}
<div class="checkbox">
    <input type="checkbox" name="savePaymentSource" value="1" />
    {{ "Save card for future purchases"|t }}
{% endif %}

# 2. Save Only

If you’d prefer to only save the payment information for future use, you can submit any regular gateway payment form to commerce/payment-sources/add instead of commerce/payments/pay.