I use commerce to create a bakery. Unfortunately, there is no module to pay by check or cash. So I use the payment example "manual". I need to debit the user account when a payment is entered (a "balance" field has been created on the user account). Is there a hook when a payment is created so that I can do this operation on the user entity?
1 Answer
One option would be to use hook_entity_create() but I would rather react on Order transition event, such as commerce_order.place.post_transition
which is triggered when Order reaches Completed state.
-
I just see that there is 3 state of payment. orders/127/payments/20/operation/receive orders/127/payments/20/operation/refund orders/127/payments/20/operation/void So I need to interact with these 3 payment states regardless of the bill status. Do U think
commerce_order.place.post_transition
should be the solution ? Commented Jun 21, 2018 at 9:58 -
Finally I must be informed when: - there is payment completed - A payment is avoided For these two cases I chose the hook_entity. - an order is completed - a command is deleted For the completed order I used the event : commerce_order.place.post_transition But I do not find a way to be informed when an order is deleted, the event commerce_order.commerce_order.delete does not work? Commented Jul 2, 2018 at 7:27