Support » Plugin: WooCommerce » failed_verification when trying to create user

  • Resolved guillermodewey

    (@guillermodewey)


    When using the woocommerce API http://woocommerce.github.io/woocommerce-rest-api-docs/?php#create-a-customer, tring to create a customer returns failed_verification with a 400 status.

    This happens using the /wp-json/wc/v2/customers and /wp-json/wc/v2/customers/batch endpoints. I’m using the Automattic\WooCommerce library for php.

    The code:

    use Automattic\WooCommerce\Client as WooClient;
    
    $wc = new WooClient( 'https://my.site','my_ck','my_cs',['wp_api' => true, 'version' => 'wc/v2' ]);
    
    $data = [
    'email'      => 'a@cdf.com',
    'first_name' => 'asdsa',
    'last_name'  => 'asdsa',
    'username'   => 'a@cdf.com',
    'role'       => 'customer',
    'password'   => 'my_pass',
    ];
    
    $wc->post('customers', $data);

    The keys work because i can use other methods for retriving products.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Con Schneider

    (@conschneider)

    Automattic Happiness Engineer

    Hi there,

    The user account you created the key with must have rights to create users. Otherwise that will fail.

    Can you also make sure that you are logged off in your browser. Postman for example uses your Google Chrome browser session.

    The API keys were created with the admin user, so it has full rights. Also, i’m using php, so no need to log off.

    I found the issue. The plugin No CAPTCHA reCAPTCHA for WooCommerce also works on the API, so it’s expecting something when trying to create a new user.

    Plugin Support Zach W

    (@dynamiczach)

    Automattic Happiness Engineer

    Thanks for letting us know, good catch!

    I’m going to close this thread now. If you need help with anything else please do let us know!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘failed_verification when trying to create user’ is closed to new replies.