woo change order status on payment

add_action( 'sliced_payment_made', 'sliced_woocommerce_set_order_status_2018_08_17', 10, 3 );
function sliced_woocommerce_set_order_status_2018_08_17( $id, $gateway, $status ) {
	if( $status === 'success' ) {
		$order_id = get_post_meta( $id, '_sliced_invoice_woocommerce_order', true );
		if( $order_id ) {
			// update woocommerce order status to 'completed'
			$order = new WC_Order($order_id);
			$order->update_status('completed');
		} else {
			return; // not tied to woocommerce order
		}
	}
}