Address Fields
Add address fields to your payment form in order to use address verification
You can add address fields such as "Address" and "Country" to your payment form. This is available as part of the full payment form and also available as its own individual component. You may choose to display either
- the full address form, or
- a partial form contains only the line 1 and postal code fields, or
- a minimal form containing only the postal code field
Information entered into these form elements will be used for address verification during processing.
No Address fields
Let's start with the code to add a card element (without any address):
components.addCard('cardElement');
Full Address
A complete address component adds the following fields:
- Address 1 (Customer must enter)
- Address 2 (Optional)
- City (Optional)
- State (Optional)
- Country (Optional)
- Postal Code (Customer must enter)
It can be included in a card element by adding the billingAddress
option with a type
of full
:
components.addCard('cardElement', {
billingAddress: {
type: "full"
}
});
Partial Address
A partial form includes only the following fields:
- Address 1 (Optional)
- Postal Code (Customer must enter)
It can be included in a card element by changing the type
to partial
:
components.addCard('cardElement', {
billingAddress: {
type: "partial"
}
});
Minimal Address
A minimal address form only includes the Postal Code field, and the customer must complete it.
It can be included in a card element by changing the type
to minimal
:
components.addCard('cardElement', {
billingAddress: {
type: "minimal"
}
});