webdevask.com

Menu

  • Home
  • New
  • Add question

php - Which WooCommerce hook or function that receives the payment response by billet and credit card?

View Original

one text

Solution:

This is the correct hook for payed orders (excluding "bacs" (bank wire) and "cheque" payments that requires to be manually complete when payment is received).

You can see that in the of WC_Order payment_complete() method (used by all payment methods), where woocommerce_payment_complete hook is located, that set the transaction ID (when it's returned by the payment gateway).

To get the transaction ID you can use the WC_Order get_transaction_id() method.

So your code will be:

add_action( 'woocommerce_payment_complete','send_payed_order_to_omie');
function send_payed_order_to_omie( $order_id ) {
    $order = wc_get_order( $order_id );

    $transaction_id = $order->get_transaction_id();

    // Your other code
}

Code goes in functions.php file of the active child theme (or active theme). It should work.

Source

See also:

  • php สร้าง Google ชีตจากบัญชีบริการ

  • php - Laravel 8.0 Installation Failed

  • javascript - How to include HTML data (tags) as value in "arrayToDataTable" of Google Pie Chart?

  • how to Grouping array in php

  • php - vender folder from my laravel project has more 1k error

© 2021
E-mail: contact@webdevask.com
Back to top