This actions runs just after a payment is inserted into the database.

do_action( 'edd_insert_payment', $payment_id, $payment_data );

$payment_id is the ID number of the payment that has just been created.

$payment_data is an array of data associated with the payment, such as price, user email, user id, purchase key, cart items, and other pieces of payment meta.

Note, payments are usually created with a status of “pending”, so this action is not reliable to use if you wish to perform a function when purchases are marked as complete. Use edd_update_payment_status instead.