• Resolved toddbenton

    (@toddbenton)


    I am using this code in functions.php to try and pass a custom checkout field to Stripe.

    add_filter( 'wc_stripe_payment_metadata', 'stripe_payment_metadata_filter_callback', 10, 3 );
    function stripe_payment_metadata_filter_callback( $metadata, $order, $prepared_source ) {
        // Here below define your custom field meta key (as it's saved in wp_postmeta DB table)
        $metadata = 'custom_meta_key';
    
        $metadata[ __( 'Custom Label Text (or meta key)', 'woocommerce-gateway-stripe' ) ] = $order->get_meta($meta_key);
    
        return $metadata;
    }

    I added my custom meta key ‘billing_child_name’ where it says:
    $metadata = ‘custom_meta_key’;

    and also in the line below that:
    $metadata[ __( ‘Custom Label Text (or meta key)’,

    I tried it first with the meta key and then with the custom label text. Each time, I get the following error:

    ====Stripe Version: 4.5.3====
    ====Start Log====
    Error: stdClass Object
    (
        [error] => stdClass Object
            (
                [message] => Invalid object
                [param] => metadata
                [type] => invalid_request_error
            )
    
    )

    What am I doing wrong?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Error when attempting to pass custom field’ is closed to new replies.