• Resolved ssjkido

    (@ssjkido)


    Hi,
    First of all, I’m pretty noob at this and I’m just trying everything I can think of, so if this is the wrong place to ask this please feel free to delete it.

    Now my question is, is it possible to make WC call a specific API using POST?

    Whenever a customer makes a successful purchase, I want to call an API sending it the Phone Number the customer used and the Amount he purchased, is such thing possible to do?

    Thank you, and sorry if I’m asking in the wrong place.

Viewing 1 replies (of 1 total)
  • jessepearson

    (@jessepearson)

    Automattic Happiness Engineer

    WooCommerce doesn’t have something that will do this out of the box. You would need to tie into one of two actions to tell when an order has been created and paid for, these actions are:

    woocommerce_order_status_{$status_transition[from]}_to_{$status_transition[to]}
    woocommerce_order_status_{$status_transition[to]}

    You would replace the {} areas with the statuses you are looking for. Typically Processing is a status where the customer has paid, but Completed is also a possibility if the product is virtual and downloadable.

    These are both referenced here:
    https://docs.woocommerce.com/wc-apidocs/hook-docs.html

    With these, there are two arguments passed, the order id and the order pbject itself, which you would be able to grab the information and work from.

Viewing 1 replies (of 1 total)
  • The topic ‘How to call an API after a successful purchase?’ is closed to new replies.