Update saved address at Stripe when billing profile is updated

Created on 25 September 2016, about 9 years ago
Updated 18 August 2025, about 1 month ago

Problem/Motivation

While working on #2511156: Add a card form not saving customer profile entity β†’ it was discovered that it's possible to lose sync between stored Drupal "Billing Address profile" entities and the address saved at Stripe through their API.

If a user updates their saved billing profile through Card on File, the address remains unchanged at Stripe. This can result in AVS (address verification system) problems such as "Zip code mismatch" errors, which leads to a poor customer experience since the user appears to have entered the correct address on file, but Stripe still has the old (invalid) address.

Proposed resolution

When a billing address profile entity is saved, call the Stripe API to update the address stored with that card. This is probably best achieved with hook_entity_presave() on the profile entity type.

Remaining tasks

Tests and review.

User interface changes

None.

API changes

If we go the entity_presave() route, this would result in an additional call every time a profile entity is saved. We should take some consideration to make sure the address is only updated in the instances that are relevant.

Another potential problem revolves around the Billing Address pane being in place at all at Checkout; ideally, we should disable or hide the Billing Address form at Checkout if the user has selected a CoF card. This problem should be addressed in a separate issue.

πŸ“Œ Task
Status

Closed: outdated

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States torgosPizza Portland, OR

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024