• Resolved warriorgear02

    (@warriorgear02)


    Hello Support Team,

    I am writing to you regarding a validation issue with the WooCommerce Stripe Payment Gateway.

    Current Setup:

    • Gateway: WooCommerce Stripe Payment Gateway (Standard, not WooPayments).
    • Updates: All plugins and WordPress core are fully up to date (latest versions).
    • Customization: I am using the plugin “Checkout Field Editor for WooCommerce”.

    The Problem: Via the Checkout Field Editor, I have configured the “State” field to be OPTIONAL (not required) for my customers. However, it seems that Stripe still triggers a validation error or requires this field during the payment process, causing transactions to fail when the field is left empty.

    Could you please clarify if the Stripe Gateway plugin enforces the “State” field regardless of WooCommerce/Checkout Editor settings? Is there a way to bypass this validation to match my checkout configuration?

    Thank you for your help.

    Best regards,

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Frank Remmy (woo-hc)

    (@frankremmy)

    Hi @warriorgear02,

    Running into payment failures, especially with Apple Pay, can be incredibly frustrating when everything else seems correctly configured.

    From what you’ve described, this does look very similar to a known issue we’re tracking where Apple Pay fails because the Stripe plugin incorrectly requires certain address fields that Apple Pay doesn’t always provide. There’s ongoing work in this area, including a recent improvement to how required fields can be filtered, but the underlying behavior is still being refined.

    To help us confirm whether your case matches the same pattern, could you please check your Stripe logs?

    You can find them here: WooCommerce → Settings → Logs. Once there, look for any recent entries related to Stripe.

    If you can share any relevant log snippets here (feel free to redact sensitive info), we’ll be able to pinpoint exactly what’s happening and guide you toward the right fix.

    We’ll get this sorted together.

    Thread Starter warriorgear02

    (@warriorgear02)

    Technical Report: Apple Pay “Missing Field” Validation Error

    Context:

    • Issue: Apple Pay transactions fail during the validation phase with a 400 Bad Request from the WooCommerce Store API.
    • Environment: WooCommerce + Stripe Gateway (Apple Pay enabled).
    • Error Message: woocommerce_rest_invalid_address — “billing: [ is required ]” or “First name is required”.

    1. Initial Bug (State/Region Requirement)

    The Stripe Gateway was incorrectly requiring the address->state field for countries like France, even when not required by the country locale or when Apple Pay’s sheet does not provide it.

    Action taken:

    Applied a filter to bypass Stripe’s internal customer field validation for the state.

    PHP

    add_filter( 'wc_stripe_create_customer_required_fields', function( $required_fields ) {
        if ( isset( $required_fields['state'] ) ) {
            unset( $required_fields['state'] );
        }
        return $required_fields;
    });
    

    2. Conflict with “Checkout Form Designer” Plugin

    While investigating, we found that a third-party plugin (Checkout Form Designer) was hiding the “State” field but also stripping the label key from the field array.

    • Impact: This caused the WooCommerce Store API to crash with an Undefined array key "label" error in OrderController.php:500 while trying to generate the validation error message.

    Action taken:

    • The plugin was deactivated to restore standard WooCommerce field metadata.

    3. Persistent “First Name” Validation Failure

    After deactivating the designer plugin and fixing the “State” issue, the Store API continued to return a 400 error claiming “First Name is required”, even though the Apple Pay payload contained the user’s name.

    Action taken (Temporary Workaround):

    To bypass this block and allow orders to process, we had to force the First Name and Last Name fields to required => false at the root level.

    PHP

    add_filter( 'woocommerce_default_address_fields', 'force_unrequire_names_root', 99999 );
    function force_unrequire_names_root( $fields ) {
        if ( isset( $fields['first_name'] ) ) $fields['first_name']['required'] = false;
        if ( isset( $fields['last_name'] ) ) $fields['last_name']['required'] = false;
        return $fields;
    }
    

    Summary of Logs for Debugging

    JSON

    {
        "code": "woocommerce_rest_invalid_address",
        "message": "First name is required",
        "last_error": {
            "type": 2, 
            "message": "Undefined array key 'label'", 
            "file": ".../plugins/woocommerce/src/StoreApi/Utilities/OrderController.php", 
            "line": 500
        }
    }
    

    Questions for the Developer:

    1. Why is the Store API failing to map the billing_first_name from the Apple Pay payload to the order, triggering a “required” field error?
    2. Why does the WooCommerce OrderController.php (line 500) not have a fallback when a field’s label is missing, causing a fatal-level error instead of a graceful validation?
    3. Is there a known conflict between the Stripe Gateway’s Apple Pay integration and the WooCommerce Store API regarding address validation for “state-less” countries?
    Plugin Support Frank Remmy (woo-hc)

    (@frankremmy)

    Hi @warriorgear02,

    Thanks for the detailed follow‑up. The information you shared looks like a summary of a different GitHub issue, and it may not be directly related to the original problem you reported. Before we dig deeper, could you confirm whether you’re still experiencing the “missing field” error with Apple Pay?

    If the issue is ongoing, it would help to know:

    • Which country your store is based in
    • Whether the problem occurs only with Apple Pay or with other payment methods as well
    • Whether the “State” field is optional due to your checkout configuration or due to your country’s address format

    Once we have that context, we can determine whether this aligns with a known issue or if something else is happening in your setup.

    Plugin Support Ejay F – a11n

    (@ejayfernandes)

    It seems we haven’t heard back from you for a while, so I’ll go ahead and mark this thread as resolved. Feel free to reach out whenever you’re ready to continue.

    Your feedback helps others – please consider leaving a review: https://ww.wp.xz.cn/support/plugin/woocommerce-gateway-stripe/reviews/

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.