I'm using commerce paypal to accept payment on a drupal website. i have configured the module as described in drupal commerce support website and created sandbox accounts both for buyer and seller. i created a test order and paid with paypal, the IPN is received successfully and it is verified according to report/dblogs with message:

IPN validated for Order 2 with ID 7DW624906V374562U.

But after this db log there's another one which is an error with message:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'name': INSERT INTO {users} (uid, created, data) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 13054 [:db_insert_placeholder_1] => 1396116964 [:db_insert_placeholder_2] => a:1:{s:7:"contact";i:1;} ) in drupal_write_record() (line 7194 of /home/findaper/public_html/includes/common.inc).

and type:


So, the payment is validated, but there's this error, and the event "when order first paid in full" is not firing. i have no idea how to fix this. can anyone help me with this??

drupal and all modules are the latest version. [drupal7]

2 Answers 2

Duplicate entry '' for key 'name': INSERT INTO {users} (uid, created, data)

This is incorrect code, since no name value defined for inserting, so user name is empty and name should be unique - you cann't insert second user with empty name.
Try find this code INSERT INTO {users} (uid, created, data) on your drupal files (modules), if no success, investigate your Rules for custom code.

  • Yup, the problem was a custom rule to change a field value for cart owner... thanks for your answer.
    – Pouya
    Commented Mar 30, 2014 at 8:38

I encountered the same issue. I have a custom rule that add a role to a user after he has completed his payment. I used site:current-user instead of commerce-order:owner. site:current-user is not defined because PayPal is an anonymous user when the IPN is processed.

So you should use commerce-order:owner in your custom rules when accessing user.

Hope that can help someone ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.