0
votes

I already done with https://acp.sample.ph/wc/v3/order created in PHP but the response of the API doesn't show the bank/account details for Bank account transfer (BACS). I am using the package automattic/woocommerce for fetching the API. This API I fetch is from WordPress woocommerce. Here's my sample code below.

    $woocommerce = new Client(
        'https://acp.sample.ph', 
        $credential['key'], 
        $credential['secrete'],
        [
            'wp_api' => true, 
            'version' => 'wc/v3',
            'query_string_auth' => true
        ]
    );

    $data = array(
        "order_id"=>"717",
        "payment_method"=>"bacs"
    );

    $accounts = $woocommerce->post('process_payment', $data);

    echo '<pre>';
    print_r($accounts);
    echo '</pre>';
1

1 Answers

0
votes

You might need to create own endpoint or alter the Order API response

Can you try this ---

function prefix_wc_rest_prepare_order_object( $response, $object, $request ) {
    // Get the value
    $bacs_info = get_option( 'woocommerce_bacs_accounts');

    $response->data['bacs_info'] = $bacs_info;

    return $response;
}
add_filter( 'woocommerce_rest_prepare_shop_order_object', 'prefix_wc_rest_prepare_order_object', 10, 3 );