Commerce product programatically with price How do I get the correct price in the site's default currency to work like the the add product form does?

This function gives a product with a price of $0.01 I want $1.00.

I am sure this has to do with calculated price?

function generate_products () {

    $product_type = 'product';

    $values = array (
        'price' =&gt; 1.00 ,
        'currency_code' =&gt; commerce_default_currency() ,
    );

    $extras = array(
        'status' =&gt; 1,
        'uid' =&gt; 1,
        'sku' =&gt; randomName ( 10 ),
        'title' =&gt; randomName ( 10 ),
    );

    commerce_installments_create_product ($product_type,$values,$extras);
}

function commerce_installments_create_product ( $product_type , $values , $extras ) {
    $form_state = array ();
    $form_state[ 'values' ] = $values;
    $form = array ();
    $form[ '#parents' ] = array ();

    // Generate a new product object
    $new_product = commerce_product_new ( $product_type );

    $new_product-&gt;status = $extras[ 'status' ];
    $new_product-&gt;uid = $extras[ 'uid' ];

    $new_product-&gt;sku = $extras[ 'sku' ];
    $new_product-&gt;title = $extras[ 'title' ];
    $new_product-&gt;created = $new_product-&gt;changed = time ();

    if ( ! empty( $values[ 'original_order' ] ) ) {
        // field_original_order[und][0][target_id]
        $order = array ( LANGUAGE_NONE =&gt; array ( 0 =&gt; array ( 'target_id' =&gt; $values[ 'original_order' ] ) ) );
        $form_state[ 'values' ][ 'field_original_order' ] = $order;
    }

    if ( ! empty( $values[ 'original_line_item' ] ) ) {
        // field_original_line_item[und][0][target_id]
        $line_item = array ( LANGUAGE_NONE =&gt; array ( 0 =&gt; array ( 'target_id' =&gt; $values[ 'original_line_item' ] ) ) );
        $form_state[ 'values' ][ 'field_original_line_item' ] = $line_item;
    }

    if ( ! empty( $values[ 'original_product' ] ) ) {
        $product = array ( LANGUAGE_NONE =&gt; array ( 0 =&gt; array ( 'target_id' =&gt; $values[ 'original_product' ] ) ) );
        $form_state[ 'values' ][ 'field_original_product' ] = $product;
    }

    //commerce_price[und][0][amount]
    $price = array ( LANGUAGE_NONE =&gt; array ( 0 =&gt; array (
        'amount' =&gt; $values[ 'price' ] ,
        'currency_code' =&gt; $values[ 'currency_code' ],
    ) ) );
    $form_state[ 'values' ][ 'commerce_price' ] = $price;

    // Notify field widgets to save their field data
    field_attach_submit ( 'commerce_product' , $new_product , $form , $form_state );

    commerce_product_save ( $new_product );
    return $new_product-&gt;product_id;
}


//function based on answer here How do I programmatically create an entity with its fields?
Prices are stocked as integer in database.

Try replacing 1.00 by 100 in your price array :

$values = array (
        'price' =&gt; 100 ,
        'currency_code' =&gt; commerce_default_currency() ,
    );


Cf : http://drupal.org/node/1124416