Warning thrown if given_name or family_name not enabled as part of address

Created on 13 September 2023, 10 months ago
Updated 15 November 2023, 7 months ago

Problem/Motivation

We aren't collecting a user's first and last name during checkout, but the code in \Drupal\commerce_stripe\Plugin\Commerce\PaymentGateway\Stripe::doCreatePaymentMethod checks for those. This throws a warning in Drupal's logs:

Warning: Undefined array key "family_name" in Drupal\commerce_stripe\Plugin\Commerce\PaymentGateway\Stripe->doCreatePaymentMethod() (line 623 of ../web/modules/contrib/commerce_stripe/src/Plugin/Commerce/PaymentGateway/Stripe.php)

Steps to reproduce

Make sure the profile you're using for your billing address is not displaying the First or Last names. Check out with a Stripe credit card. See the warnings in the logs.

Proposed resolution

Just adding a check to make sure those values exist should solve the warnings, but I'm curious if there is any issue with not sending the owner's name to Stripe? Does validation fail, or is it seen as risky?

Remaining tasks

Provide patch to hide the warnings, or close as "won't fix" if it's important that that info be sent.

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Card Element

Created by

πŸ‡ΊπŸ‡ΈUnited States mariacha1

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

Comments & Activities

Production build 0.69.0 2024